using Library.Common;
using MuEditor.Properties;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Net;
using System.Resources;
using System.Text;
using System.Windows.Forms;

namespace MuEditor
{
    public partial class Warehouse : Form
    {
        public Warehouse()
        {
            InitializeComponent();
        }

        protected byte[] loadWarehouse(string account)
        {
            string str = null;
            if (account == "")
            {
                return null;
            }
            byte[] value = null;
            try
            {
                str = string.Concat("SELECT [Items], [Money], [pw] FROM [warehouse] WHERE ([AccountID] = '", account, "')");
                OleDbDataReader oleDbDataReader = (new OleDbCommand(str, frmBase.Mu_Conn)).ExecuteReader();
                if (!oleDbDataReader.Read() || oleDbDataReader.GetValue(0) == DBNull.Value)
                {
                    this.txtWareHouseMoney.Text = "0";
                    this.txtWareHousePwd.Text = "0";
                }
                else
                {
                    value = (byte[])oleDbDataReader.GetValue(0);
                    this.txtWareHouseMoney.Text = Convert.ToString(oleDbDataReader.GetValue(1));
                    this.txtWareHousePwd.Text = Convert.ToString(oleDbDataReader.GetValue(2));
                }
                oleDbDataReader.Close();
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                string[] message = new string[] { "SQL：", str, "\nError:", exception.Message, "\nSource:", exception.Source, "\nTrace:", exception.StackTrace };
                Utils.WarningMessage(string.Concat(message));
            }
            return value;
        }
    }
}
