Exemple #1
0
        public Frm_Main()
        {
            //卸载与安装
            if (!File.Exists(Application.StartupPath + "\\Packaging.mdb") && File.Exists(Application.StartupPath + "\\Backup\\Packaging.mdb"))
            {
                File.Copy(Application.StartupPath + "\\Backup\\Packaging.mdb", Application.StartupPath + "\\Packaging.mdb", true);
            }

            //2013.11.20
            //检查数据库是否存在

            if (!File.Exists(Application.StartupPath + "\\Packaging.mdb"))
            {
                MessageBox.Show("程序根目录中数据库文件Packaging.MDB不存在");
                System.Environment.Exit(System.Environment.ExitCode);
                this.Dispose();
                this.Close();
                return;
            }

            PublicFunc.Init();
            DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true;
            // PublicFunc.ReadXMLConfigure();

            InitializeComponent();
            BI_ListClose_ItemClick(this, null);
            TE_Title.Text = "Packaging";
            RC_Main.DefaultPageCategory.Expanded = true;
            RC_Main.Minimized = true;
            InitSkinGallery();



            db = new DataBaseManage();

            TxtData.XMLConfigure.RegCode = db.GetRegCode();
            TxtData.XMLConfigure.Reged   = PublicFunc.CompareCode(TxtData.XMLConfigure.RegCode);
            db.SaveCs8cConfigure();
            PublicFunc.ReadCs8CConfigure();

            db.GetIp(ref TxtData.XMLConfigure.IpAddress, ref TxtData.XMLConfigure.RestrictCode);
            db.GetPopedom(ref TxtData.PublicData.ScreenEnable);

            TxtData.XMLConfigure.User = db.GetAutoLogin();


            if (TxtData.XMLConfigure.User != null)
            {
                TxtData.XMLConfigure.Login   = true;
                TxtData.XMLConfigure.PopeDom = db.GetUserPopm(TxtData.XMLConfigure.User);
                db.AddLog(TxtData.XMLConfigure.User + "登录");
            }
            PublicFunc.ReadXMLConfigure();


            poll = new Thread(new ThreadStart(PublicFunc.Poll));
            poll.Start();
        }
Exemple #2
0
        private void BT_ok_Click(object sender, EventArgs e)
        {
            if (TB_Code.Text.Trim() == "")
            {
                MessageBox.Show("输入不能为空!");
                return;
            }
            switch (Type)
            {
            case 1:
            {
                string[] data = TB_Code.Text.Trim().Split('.');
                if (data.Length != 4)
                {
                    MessageBox.Show("输入位数不正确!");
                    return;
                }
                TxtData.XMLConfigure.IpAddress = TB_Code.Text.Trim();
                break;
            }

            case 2:
            {
                if (TB_Code.Text.Trim().Length != 6)
                {
                    MessageBox.Show("输入位数不等于6!");
                    return;
                }

                //2014.08.08
                //修改加密方式

                int Ind = TxtData.XMLConfigure.RegCode.ToUpper().IndexOf(TB_Code.Text.Trim().ToUpper());
                if (Ind < 0 || Ind % 6 != 0)
                {
                    MessageBox.Show("输入不正确!");
                    return;
                }

                TxtData.XMLConfigure.RestrictCode = TB_Code.Text.Trim();
                break;
            }
            }

            if (!db.EditIp(TxtData.XMLConfigure.IpAddress, TxtData.XMLConfigure.RestrictCode))
            {
                MessageBox.Show("数据库出错");
                return;
            }
            if (Type == 2)
            {
                // TxtData.XMLConfigure.RestrictCode=
                PublicFunc.ReadXMLConfigure();
            }

            this.Close();
        }