コード例 #1
0
        private void Login_Load(object sender, EventArgs e)
        {
            textEditUser.Properties.CharacterCasing = CharacterCasing.Upper;
            vCheckEditRemote.EditValue = bool.Parse(Config.GetValue("isRemote").ToString());
            string StructConnectionEx = Registry.GetValue(H_KEY, "StructDb", string.Empty).ToString();

            StructConnection = Security.DeCode64(StructConnectionEx);

            RemoteStructConnection = Registry.GetValue(H_KEY, "RemoteServer", string.Empty).ToString();
            RemoteStructConnection = Security.DeCode64(RemoteStructConnection);
            vCheckEditRemote_CheckedChanged(vCheckEditRemote, new EventArgs());

            P_KEY = H_KEY;
            GetData();
            foreach (DevExpress.Skins.SkinContainer cnt in DevExpress.Skins.SkinManager.Default.Skins)
            {
                comboBoxEditStyle.Properties.Items.Add(cnt.SkinName);
            }
            if (comboBoxEditStyle.Text != string.Empty)
            {
                defaultLookAndFeelMain.LookAndFeel.SetSkinStyle(comboBoxEditStyle.Text);
            }
            //this.Height = 260;
            Database _dbStruct = Database.NewCustomDatabase(StructConnection);


            if (_dbStruct.Connection.DataSource.Contains("45."))
            {
                string             _databaseName = _dbStruct.Connection.Database;
                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(StructConnection);
                string         ob  = JsonConvert.SerializeObject(computer);
                CDTControl.Log log = new CDTControl.Log();
                string         re  = log.CheckComputer(ob);
                if (re == null || re == "")
                {
                    MessageBox.Show("Máy này đã không còn được phép truy cập vào dữ liệu, do đổi tên máy hoặc đã bị Admin khóa");
                    this.DialogResult = DialogResult.Cancel;
                }
            }
        }
コード例 #2
0
ファイル: RegisterF.cs プロジェクト: trancongvy/SGDPV
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            CDTControl.Log log      = new CDTControl.Log();
            string         isOnline = int.Parse(rgOnline.EditValue.ToString()) == 0 ? "" : "1";

            if (rgCnnType.SelectedIndex == 0)
            {
                cpu = new CPUid(textCompanyName.Text + _ProductName + "SGDEMTOnline" + isOnline);
            }
            else if (rgCnnType.SelectedIndex == 1)
            {
                cpu = new CPUid(textCompanyName.Text + _ProductName + "SGDBPMOnline" + isOnline);
            }
            txtMaMay.Text = cpu.MaMay;
            bool kq = false;

            try
            {
                UserKey uKey = new UserKey();
                uKey.ID       = 0; uKey.UserID = tfbID.Text; uKey.companyName = textCompanyName.Text; uKey.Mamay = txtMaMay.Text;
                uKey.CDate    = DateTime.Now; uKey.DaTT = 0; uKey.IDGT = tIDGT.Text; uKey.isOnline = int.Parse(rgOnline.EditValue.ToString());
                uKey.Product  = rgCnnType.SelectedIndex == 0 ? "Phần mềm kế toán" : "Giải pháp BPM";
                uKey.Maskcode = cpu.MixString; uKey.LicenseKey = cpu.KeyString; uKey.Exdate = DateTime.Now.AddYears(int.Parse(tSonam.EditValue.ToString()));

                string ob = JsonConvert.SerializeObject(uKey);

                textEditMaskcode.Text = cpu.MixString;
                string key    = cpu.KeyString;
                string keyGet = log.logFb(ob);
                if (keyGet != "")
                {
                    UserKey returnKey1 = JsonConvert.DeserializeObject <UserKey>(keyGet);
                    textEditValue.Text           = returnKey1.LicenseKey;
                    simpleButtonRegister.Enabled = true;
                    simpleButtonRegister_Click(sender, e);
                }
                else
                {
                    // textEditValue.Text = keyGet;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
ファイル: CreateData.cs プロジェクト: trancongvy/SGDPV
        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!");
                }
            }
        }
コード例 #4
0
ファイル: RegisterF.cs プロジェクト: trancongvy/SGDOnline
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            CDTControl.Log log      = new CDTControl.Log();
            string         isOnline = int.Parse(rgOnline.EditValue.ToString()) == 0 ? "" : "1";

            if (rgCnnType.SelectedIndex == 0)
            {
                cpu = new CPUid(textCompanyName.Text + _ProductName + "SGDEMTOnline" + isOnline);
            }
            else if (rgCnnType.SelectedIndex == 1)
            {
                cpu = new CPUid(textCompanyName.Text + _ProductName + "SGDBPMOnline" + isOnline);
            }
            txtMaMay.Text = cpu.MaMay;
            bool kq = false;

            try
            {
                UserKey uKey = new UserKey();
                uKey.ID       = 0; uKey.UserID = tfbID.Text; uKey.companyName = textCompanyName.Text; uKey.Mamay = txtMaMay.Text;
                uKey.CDate    = DateTime.Now; uKey.DaTT = 0; uKey.IDGT = tIDGT.Text; uKey.isOnline = int.Parse(rgOnline.EditValue.ToString());
                uKey.Product  = rgCnnType.SelectedIndex == 0 ? "Phần mềm kế toán" : "Giải pháp BPM";
                uKey.Maskcode = cpu.MixString; uKey.LicenseKey = cpu.KeyString; uKey.Exdate = DateTime.Now.AddYears(1);

                string ob = JsonConvert.SerializeObject(uKey);

                textEditMaskcode.Text = cpu.MixString;
                string key    = cpu.KeyString;
                string keyGet = log.logFb(ob);
                if (keyGet != "")
                {
                    UserKey returnKey1 = JsonConvert.DeserializeObject <UserKey>(keyGet);
                    textEditValue.Text           = returnKey1.LicenseKey;
                    simpleButtonRegister.Enabled = true;
                    //Đăng ký tên máy - Key cho server
                    if (isOnline == "1")
                    {
                        UserConnection uCon = new UserConnection();
                        uCon.ComputerName = uKey.Mamay; uCon.DatabaseName = _ProductName; uCon.LicenceKey = returnKey1.LicenseKey;
                        uCon.StructDb     = ""; uCon.TimeEx = DateTime.Now.AddYears(int.Parse(sSonam.Value.ToString()));
                        ob = JsonConvert.SerializeObject(uCon);
                        string re = RegistConnection(ob);
                        uCon = JsonConvert.DeserializeObject <UserConnection>(re);

                        if (uCon != null)
                        {
                            string Con = GetConnection(uCon.stt);
                            uCon = JsonConvert.DeserializeObject <UserConnection>(Con);


                            string StructConnection = Security.DeCode64(uCon.StructDb);
                            StructConnection += ";Database = " + Config.GetValue("ProductName").ToString();
                            Config.NewKeyValue("StructConnection", Security.EnCode64(StructConnection));
                        }
                    }
                    simpleButtonRegister_Click(sender, e);
                }
                else
                {
                    // textEditValue.Text = keyGet;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }