private void BuildLicense()
        {
            try
            {
                if (date_ExpDate.EditValue == null || date_ExpDate.DateTime <= DateTime.Now.Date)
                {
                    lblMsg.Text = "Exp.Date Invalid!!!";
                    date_ExpDate.Focus();
                    return;
                }

                if (inputLookUp_Company.EditValue.ToString() == BuildLicenseUtil.ParentCompanyID.ToString())
                {
                    lblMsg.Text = "Please choose company";
                    inputLookUp_Company.Focus();
                    return;
                }
                string licenseCode = "";
                txtLicenseKey.Text  = CompanyLicense.Inst.BuildLicenseKey(_objRequestLicenseKey, date_ExpDate.DateTime, out licenseCode);
                txtLicenseCode.Text = licenseCode;
                if (txtAPICode.Text.Trim() != "")
                {
                    txtAPIKey.Text = BuildLicenseUtil.BuildEncrypt(txtAPICode.Text.Trim());
                }

                DisableControl();
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("StaxiMan BuildLicense", ex);
            }
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!CheckValid())
                {
                    return;
                }

                APILicense objApiCode = new APILicense();
                objApiCode.Id           = _id;
                objApiCode.APICode      = txtAPICode.Text.Trim();
                objApiCode.APIKey       = BuildLicenseUtil.BuildEncrypt(txtAPICode.Text.Trim());
                objApiCode.FK_CompanyID = cboCompany.EditValue.To <int>();
                if (_id == -1)//Add Api Code cho công ty!
                {
                    objApiCode.Insert();
                }
                else
                {
                    objApiCode.Update();
                }

                new MessageBoxBA().Show("Cập nhật thông tin API License thành công!", "Thông báo", MessageBoxButtonsBA.OK, MessageBoxIconBA.Information);
                ResetForm();
                RefreshGridControl();
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("btnSave_Click: ", ex);
            }
        }
        private void BuildLicense()
        {
            if (date_ExpDate.EditValue == null || date_ExpDate.DateTime <= DateTime.Now.Date)
            {
                lblMsg.Text = "Exp.Date Invalid!!!";
                date_ExpDate.Focus();
                return;
            }

            if (inputLookUp_Company.EditValue.ToString() == BuildLicenseUtil.ParentCompanyID.ToString())
            {
                lblMsg.Text = "Please choose company";
                inputLookUp_Company.Focus();
                return;
            }
            string licenseCode = "";

            txtLicenseKey.Text  = CompanyLicense.Inst.BuildLicenseKey(ResponsedItem, date_ExpDate.DateTime, out licenseCode);
            txtLicenseCode.Text = licenseCode;
            if (txtAPICode.Text.Trim() != "")
            {
                txtAPIKey.Text = BuildLicenseUtil.BuildEncrypt(txtAPICode.Text.Trim());
            }
            //Build lại license thì mặc định là active lại cho license đó
            CompanyLicenseItem.IsActive = true;
            btnActive.Text    = "Deactive";
            btnActive.Enabled = false;
        }