Ejemplo n.º 1
0
        private void simpleButtonOk_Click(object sender, EventArgs e)
        {
            if (this.dxErrorProviderMain.HasErrors)
            {
                XtraMessageBox.Show("Thông tin chưa hợp lệ, vui lòng kiểm tra lại!");
            }
            else
            {
                this._ver = this.txtCDT.Text;
                string       text       = this.textEditServer.Text;
                string       textRemote = this.txtRemoteServer.Text;
                DataMaintain maintain   = new DataMaintain(text, textRemote, this.radioGroupCnnType.SelectedIndex, this.textEditUser.Text, this.textEditPassword.Text);

                maintain.isServer2005 = this.cEis2005.Checked;


                this.layoutControl1.Refresh();
                bool   flag  = false;
                string H_KEY = Config.GetValue("H_KEY").ToString();
                if (this.radioGroupType.SelectedIndex == 1)
                {
                    flag = maintain.ClientExecute(this._ver);

                    if (flag)
                    {
                    }
                    if (flag && ckUpdateRemote.Checked)
                    {
                        maintain.UpdateRemoteServer(txtRemoteServer.Text, this._ver);
                    }
                    if (flag && CkUpdateLocal.Checked)
                    {
                        maintain.UpdateLocalServer(text, this._ver);
                    }
                }
                else
                {
                    flag = maintain.ServerExecute(Application.StartupPath, this._ver);
                }
                if (flag)
                {
                    Registry.SetValue(H_KEY, "StructName", _ver);
                    base.DialogResult = DialogResult.OK;
                }
                else
                {
                    XtraMessageBox.Show("Có lỗi trong quá trình tạo số liệu, vui lòng kiểm tra lại!");
                }
            }
        }
Ejemplo n.º 2
0
        private void simpleButtonOk_Click(object sender, EventArgs e)
        {
            if (this.dxErrorProviderMain.HasErrors)
            {
                XtraMessageBox.Show("Thông tin chưa hợp lệ, vui lòng kiểm tra lại!");
            }
            else
            {
                this._ver = this.txtCDT.Text;
                string       text       = this.textEditServer.Text;
                string       textRemote = this.txtRemoteServer.Text;
                DataMaintain maintain   = new DataMaintain(text, textRemote, this.radioGroupCnnType.SelectedIndex, this.textEditUser.Text, this.textEditPassword.Text);

                maintain.isServer2005 = this.cEis2005.Checked;


                this.layoutControl1.Refresh();
                bool flag = false;
                if (this.radioGroupType.SelectedIndex == 1)
                {
                    flag = maintain.ClientExecute(this._ver);
                    string H_KEY = Config.GetValue("H_KEY").ToString();
                    if (flag)
                    {
                    }
                    if (flag && ckUpdateRemote.Checked)
                    {
                        maintain.UpdateRemoteServer(txtRemoteServer.Text, this._ver);
                    }
                    if (flag && CkUpdateLocal.Checked)
                    {
                        maintain.UpdateLocalServer(text, this._ver);
                    }
                }
                else
                {
                    flag = maintain.ServerExecute(Application.StartupPath, this._ver);
                }
                if (flag)
                {
                    //Đăng ký sử dụng nếu là dataonline
                    if (text.Contains("45."))
                    {
                        string             _databaseName = _ver;
                        CPUid              cpu           = new CPUid(Config.GetValue("ProductName").ToString());
                        ComputerConnection computer      = new ComputerConnection();
                        computer.ComputerName = SystemInformation.ComputerName;
                        computer.CPUID        = cpu.MaMay;
                        computer.DatabaseName = _databaseName;
                        computer.LicenceKey   = "";//cpu.GetKeyString();
                        computer.StructDB     = Security.EnCode64(maintain.Connection);
                        string         ob  = JsonConvert.SerializeObject(computer);
                        CDTControl.Log log = new CDTControl.Log();
                        string         re  = log.RegistComputer(ob);
                        if (re == null || re == "")
                        {
                            XtraMessageBox.Show("Có lỗi trong quá trình tạo số liệu, vui lòng kiểm tra lại!");
                            return;
                        }
                    }
                    base.DialogResult = DialogResult.OK;
                }
                else
                {
                    XtraMessageBox.Show("Có lỗi trong quá trình tạo số liệu, vui lòng kiểm tra lại!");
                }
            }
        }