private void radioGroupLanguage_SelectedIndexChanged(object sender, EventArgs e) { LanguageForPackage(radioGroupLanguage.SelectedIndex == 0); try { _sysPackage = new SysPackage(); _sysPackage.InitDictionary(); DevLocalizer.Translate(this); } catch { } }
private void simpleButtonOk_Click(object sender, EventArgs e) { _sysUser = new SysUser(); _sysPackage = new SysPackage(); _sysConfig = new SysConfig(); if (dxErrorProviderMain.HasErrors) { XtraMessageBox.Show("Vui lòng cung cấp đủ thông tin yêu cầu"); return; } if (textEditPassword.Text != _sysUser.maskPwd) { pwd = Security.EnCode(textEditPassword.Text); } if (!_sysUser.CheckLogin(textEditUser.Text, pwd)) { XtraMessageBox.Show("Thông tin đăng nhập chưa chính xác, vui lòng kiểm tra lại!"); return; } drUser = _sysUser.DrUser; DataTable dt1 = _sysPackage.GetPackageForUser(_sysUser); if (dt1 == null) { return; } if (dt1.Rows.Count == 0) { XtraMessageBox.Show("Người dùng này chưa được phân quyền sử dụng gói phần mềm nào!"); return; } //dang nhap thanh cong Config.NewKeyValue("StructServer", _sysPackage.StructServer); lookUpEditPackage.Properties.DataSource = dt1; lookUpEditPackage.Properties.DisplayMember = radioGroupLanguage.SelectedIndex == 0 ? "PackageName" : "PackageName2"; lookUpEditPackage.Properties.ValueMember = "sysDBID"; if (dt1.Rows.Count == 1) { drPackage = dt1.Rows[0]; lookUpEditPackage.EditValue = dt1.Rows[0]["sysDBID"]; Config.NewKeyValue("Admin", bool.Parse(dt1.Rows[0]["isAdmin"].ToString())); Config.NewKeyValue("sysUserPackageID", dt1.Rows[0]["sysUserPackageID"]); if (_sysConfig.DsStartConfig == null || _sysConfig.DsStartConfig.Tables[0].Rows.Count == 0) { DangNhap(); } else { simpleButtonLogin_Click(simpleButtonLogin, new EventArgs()); //this.Height = 300; //layoutControl2.Visible = true; ////layoutControlItemLogin.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; //layoutControlItemStartConfig.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; //layoutControlItemPackage.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } } else { // this.Height = 340; //layoutControl2.Size = new System.Drawing.Size(583, 40); simpleButtonLogin.Visible = true; lookUpEditPackage.Visible = true; // layoutControl2.Visible = true; lc1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; lc2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; lookUpEditPackage.Focus(); //layoutControlItemStartConfig.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; //layoutControlItemPackage.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } }
/// <summary> /// Load 4 quarter /// </summary> private void LoadQuarter() { int defaultPeriod = 1; SysPackage sp = new SysPackage(); DataTable dtData = sp.GetQuarterForAccounting(); if (dtData == null) //neu khong phai la PMKT thi khong chay tiep { return; } foreach (DataRow dr in dtData.Rows) { this.cboQuarter.Properties.Items.Add(dr[0]); } // Load default period if (Config.GetValue("KyKeToan") != null) { defaultPeriod = int.Parse(Config.GetValue("KyKeToan").ToString()); this.cboQuarter.EditValue = (int)Math.Ceiling((decimal)defaultPeriod / 3); } }