/// <summary>
        /// LaySoLieu_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LaySoLieu_Load(object sender, EventArgs e)
        {
            this.FormatColumns();

            this._Database = Database.NewDataDatabase();
            _NamTaiChinh = Config.GetValue("NamLamViec") == null ? -1 : int.Parse(Config.GetValue("NamLamViec").ToString());

            gridView2.OptionsBehavior.Editable = true;
            InitialEditStatus();

            if (_InLanDau)
            {
                _BoSungLan = 0;
            }

            if (this._Action == FormAction.AddNew)
            {
                _DataMain = this.GetStandardData();
            }
            else
            {
                _DataMain = this.GetData();
            }

            if (_DataMain != null)
            {
                grdDetail.DataSource = _DataMain;
            }

            CalculateAmount();

            if (Config.GetValue("Language").ToString() == "1")
            {
                FormFactory.DevLocalizer.Translate(this);
            }
        }
Example #2
0
        private void SetData()
        {
            string sysPackageID = drPackage["sysPackageID"].ToString();

            string sysDBID = drPackage["sysDBID"].ToString();
            string DbName  = drPackage["DbName"].ToString();
            //string DBName = drPackage["PackageName"].ToString();

            string DataConnection = Security.DeCode64(drPackage["DbPath"].ToString()) + ";Database = " + DbName;

            if (Boolean.Parse(Config.GetValue("isRemote").ToString()))
            {
                DataConnection = Security.DeCode64(drPackage["DbPathRemote"].ToString()) + ";Database = " + DbName;
            }
            string CompanyName = Registry.GetValue(P_KEY, "CompanyName", string.Empty).ToString();

            Config.NewKeyValue("ComputerName", SystemInformation.ComputerName);
            Config.NewKeyValue("TenCongTy", CompanyName);
            Config.NewKeyValue("sysPackageID", sysPackageID);
            Config.NewKeyValue("sysDBID", sysDBID);
            Config.NewKeyValue("DbName", DbName);

            Config.NewKeyValue("DataConnection", DataConnection);
            CDTDatabase.Database db = CDTDatabase.Database.NewDataDatabase();
            if (db.Connection.DataSource != null)
            {
                Config.NewKeyValue("DataServer", db.Connection.DataSource);
            }
            Config.NewKeyValue("Package", drPackage["Package"].ToString());
            Config.NewKeyValue("Version", drPackage["Version"].ToString());
            Config.NewKeyValue("Copyright", drPackage["Copyright"].ToString());
            Config.NewKeyValue("PackageName", drPackage["PackageName"].ToString());
            Config.NewKeyValue("sysUserID", drUser["sysUserID"].ToString());
            Config.NewKeyValue("sysUserGroupID", drUser["sysUserGroupID"].ToString());
            Config.NewKeyValue("GroupName", drUser["GroupName"].ToString());
            Config.NewKeyValue("Style", comboBoxEditStyle.Text);
            Config.NewKeyValue("Language", radioGroupLanguage.SelectedIndex);
            Registry.SetValue(H_KEY, "Package", sysDBID);
            Registry.SetValue(H_KEY, "Style", comboBoxEditStyle.Text);
            Registry.SetValue(H_KEY, "Language", radioGroupLanguage.SelectedIndex);
            Registry.SetValue(H_KEY, "SavePassword", vCheckEditSavePwd.Checked.ToString());
            if (!Boolean.Parse(_sysUser.DrUser["CoreAdmin"].ToString()))
            {
                Registry.SetValue(H_KEY, "UserName", textEditUser.Text);
            }
            Config.NewKeyValue("UserName", textEditUser.Text);
            Config.NewKeyValue("FullName", drUser["FullName"].ToString());
            if (drUser.Table.Columns.Contains("SdtUser"))
            {
                Config.NewKeyValue("SdtUser", drUser["SdtUser"].ToString());
            }
            if (drUser.Table.Columns.Contains("TheoCa"))
            {
                Config.NewKeyValue("TheoCa", drUser["TheoCa"] == DBNull.Value? false: bool.Parse(drUser["TheoCa"].ToString()));
            }
            if (drUser.Table.Columns.Contains("MaCN") && drUser["MaCN"] != DBNull.Value && drUser["MaCN"].ToString() != string.Empty)
            {
                Config.NewKeyValue("MaCN", drUser["MaCN"].ToString());
            }
            Config.NewKeyValue("NgayHethong", _sysPackage.ngayht());
            if (!Boolean.Parse(_sysUser.DrUser["CoreAdmin"].ToString()) && vCheckEditSavePwd.Checked)
            {
                if (textEditPassword.Text != _sysUser.maskPwd)
                {
                    Registry.SetValue(H_KEY, "Password", Security.EnCode(textEditPassword.Text));
                }
                else
                {
                    Registry.SetValue(H_KEY, "Password", pwd);
                }
            }
            Config.NewKeyValue("fbID", Registry.GetValue(H_KEY, "fbID", string.Empty).ToString());
            Config.NewKeyValue("SoftType", Registry.GetValue(H_KEY, "SoftType", 0).ToString());
            var k = Config.GetValue("SoftType");
        }
        private void TaoToKhai_Load(object sender, EventArgs e)
        {
            this._Database = Database.NewDataDatabase();

            this.dtmDatePost.DateTime = DateTime.Now;
            _NamTaiChinh = Config.GetValue("NamLamViec") == null ? -1 : int.Parse(Config.GetValue("NamLamViec").ToString());

            LoadPeriod();
            LoadQuarter();

            CheckRemoveStatus();
            checkComboStatus();

            if (Config.GetValue("Language").ToString() == "1")
            {
                FormFactory.DevLocalizer.Translate(this);
            }
        }