private void frmInput_Load(object sender, EventArgs e) { inputBLL = new InputBLL(); objectBLL = new ObjectBLL(); inputObj = new Input(); inputObjSea = new Input(); // Load data for supplier LoadSuppliers(); }
private void frmManageOject_Load(object sender, EventArgs e) { // khởi tạo các đối tượng objBLL = new ObjectBLL(); // load tat ca cac bien tham so lua chon... LoadStatus(); LoadGender(); LoadProvince(); LoadObjectGroup(); LoadOBjectType(); }
public void LoadUser() { dt1 = objBLL.GetUser(); _iTotalRec = dt1.Rows.Count; Dictionary <string, string> test = new Dictionary <string, string>(); //string str; ObjectBLL objectBLL = new ObjectBLL(); foreach (DataRow dr in dt1.Rows) { string fullName = objectBLL.GetObjectByObjectId(dr["ObjectId"].ToString()).Rows[0]["FullName"].ToString(); //str = dr["UserId"].ToString() + fullName;// + "," + dr["EmployeeName"].ToString(); test.Add(dr["UserId"].ToString(), fullName); } clbUser.DataSource = new BindingSource(test, null); clbUser.DisplayMember = "Value"; clbUser.ValueMember = "Key"; }
/// <summary> /// event rise when user click Agree button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAgree_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(txtUsername.Text.Trim()) && String.IsNullOrWhiteSpace(txtPassword.Text.Trim())) { CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("PleaseInputInformationLogin"), Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); return; } if (String.IsNullOrWhiteSpace(txtUsername.Text.Trim())) { CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("PleaseInputUsername"), Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); return; } if (String.IsNullOrWhiteSpace(txtPassword.Text.Trim())) { CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("PleaseInputPassword"), Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); return; } //if (chkAdvanced.Checked == true) //{ // string tss = txtServer.Text; // tss = tss.Replace("http://", ""); // tss = tss.Replace("/", ""); // Program.urlImage = tss; // Program.destopService.Url = "http://" + tss + "/VVPosService.asmx"; // Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); // configuration.AppSettings.Settings["MyLastURL"].Value = tss; // configuration.Save(); // ConfigurationManager.RefreshSection("appSettings"); // string APPNODE = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + ".Properties.Settings"; // string val = "http://" + txtServer.Text.Trim() + "/VVPosService.asmx"; // Common.Utility.UpdateApplicationSettings(APPNODE, "VVPosS_VVPosService_VVPosService", val); //} try { UsersBLL usersBLL = new UsersBLL(); string idOrUsername = txtUsername.Text; string password = Program.ConvertStringToMD5(txtPassword.Text.Trim()); bool ok = usersBLL.CheckLogin(idOrUsername, password); if (ok) { // gán culture vào hệ thống Common.clsLanguages.SetCulture(Common.clsLanguages.StrCulture); //RolesBLL rolesBLL = new RolesBLL(); //Program.lstRole = rolesBLL.GetRoleOfUser(Program.users.EmployeeId); if (Program.users.RoleId == "letan" || Program.users.RoleId == "admin") { if (string.IsNullOrEmpty(usersBLL.ErrorString)) { string _sObjectId = usersBLL.GetObjectIdByUserId(idOrUsername).Rows[0][0].ToString(); ObjectBLL objectBLL = new ObjectBLL(); Program.FullName = objectBLL.GetObjectByObjectId(_sObjectId).Rows[0]["FullName"].ToString(); Program.ImageUser = objectBLL.GetObjectByObjectId(_sObjectId).Rows[0]["Image"].ToString(); MainForm frm = new MainForm(); frm.Show(); txtUsername.Clear(); txtPassword.Clear(); //cbbLanguage.SelectedIndex = -1; txtUsername.Focus(); this.Hide(); } else { MessageBox.Show(usersBLL.ErrorString, Common.clsLanguages.GetResource("Error"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("YouAreNotPermissionAccess"), Common.clsLanguages.GetResource("Error"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Error, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); txtUsername.Focus(); return; } } else { CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("LoginError"), Common.clsLanguages.GetResource("Error"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Error, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); return; } } catch (Exception ex) { string code = System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(); if (code == "-532462766") { CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CurrentlyTheDeviceIsNotConnectedInternet") + " - Last Link : " + Program.destopService.Url, Common.clsLanguages.GetResource("Information"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK); } return; } }