/// <summary> /// cbBCountry /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GetList_Country() { DataTable dataTableCountry = countryBLL.GetLists(); cbBCountry.DataSource = dataTableCountry; if (Common.clsLanguages.StrCulture.Equals("vi-VN")) { DataRow rowContry = dataTableCountry.NewRow(); rowContry["CountryId"] = "0000"; rowContry["CountryName"] = "<-- " + Common.clsLanguages.GetResource("CRM393") + " -->"; dataTableCountry.Rows.InsertAt(rowContry, 0); cbBCountry.DisplayMember = "CountryName"; } else if (Common.clsLanguages.StrCulture.Equals("ja-JP")) { DataRow rowContry = dataTableCountry.NewRow(); rowContry["CountryId"] = "0000"; rowContry["CountryName2"] = "<-- " + Common.clsLanguages.GetResource("CRM393") + " -->"; dataTableCountry.Rows.InsertAt(rowContry, 0); cbBCountry.DisplayMember = "CountryName2"; } else if (Common.clsLanguages.StrCulture.Equals("en-US")) { DataRow rowContry = dataTableCountry.NewRow(); rowContry["CountryId"] = "0000"; rowContry["CountryName3"] = "<-- " + Common.clsLanguages.GetResource("CRM393") + " -->"; dataTableCountry.Rows.InsertAt(rowContry, 0); cbBCountry.DisplayMember = "CountryName3"; } cbBCountry.ValueMember = "CountryId"; }
public void LoadData() { //load membertype DataTable dt = new DataTable(); dt = memberTypeBLL.GetListsNameNotNull(); if (dt != null) { lstMemberType.DataSource = dt; if (Common.clsLanguages.StrCulture.Equals("vi-VN")) { lstMemberType.DisplayMember = dt.Columns["MemberTypeName"].ToString(); } else if (Common.clsLanguages.StrCulture.Equals("en-US")) { lstMemberType.DisplayMember = dt.Columns["MemberTypeName3"].ToString(); } else if (Common.clsLanguages.StrCulture.Equals("ja-JP")) { lstMemberType.DisplayMember = dt.Columns["MemberTypeName2"].ToString(); } lstMemberType.ValueMember = dt.Columns["MemberTypeId"].ToString(); } //load data for cbb nationality DataTable dtCountry = new DataTable(); dtCountry = countryBLL.GetLists(); if (dtCountry != null) { this.cbbNationality.DataSource = dtCountry; if (Common.clsLanguages.StrCulture.Equals("vi-VN")) { this.cbbNationality.DisplayMember = dtCountry.Columns["CountryName"].ToString(); } else if (Common.clsLanguages.StrCulture.Equals("en-US")) { this.cbbNationality.DisplayMember = dtCountry.Columns["CountryName3"].ToString(); } else if (Common.clsLanguages.StrCulture.Equals("ja-JP")) { this.cbbNationality.DisplayMember = dtCountry.Columns["CountryName2"].ToString(); } this.cbbNationality.ValueMember = dtCountry.Columns["CountryId"].ToString(); } //Điệp add 20140418 //load data for cbb CallName DataTable dtCallName = new DataTable(); dtCallName = callnameBLL.GetLists(); if (dtCallName != null) { this.cbBCallName.DataSource = dtCallName; this.cbBCallName.ValueMember = dtCallName.Columns["CallNameID"].ToString(); if (Common.clsLanguages.StrCulture.Equals("vi-VN")) { this.cbBCallName.DisplayMember = dtCallName.Columns["Name1"].ToString(); } else if (Common.clsLanguages.StrCulture.Equals("en-US")) { this.cbBCallName.DisplayMember = dtCallName.Columns["Name2"].ToString(); } else if (Common.clsLanguages.StrCulture.Equals("ja-JP")) { for (int i = 1; i < dtCallName.Rows.Count; i++) { dtCallName.Rows[i].Delete(); } this.cbBCallName.DisplayMember = dtCallName.Columns["Name3"].ToString(); this.cbBCallName.SelectedIndex = (Common.clsLanguages.StrCulture.Equals("ja-JP")) ? 0 : dtCallName.Rows.Count - 1; } } //End Điệp add 20140418 //Begin Linh 25-12-2014 #region ComboBox cbb CategoryActions DataTable dtCategory = new DataTable(); dtCategory = categoryactionsBLL.GetLists(); if (dtCategory != null) { this.cbBCategoryAction.DataSource = dtCategory; if (Common.clsLanguages.StrCulture.Equals("vi-VN")) { this.cbBCategoryAction.DisplayMember = dtCategory.Columns["CategoryActionName"].ToString(); } else if (Common.clsLanguages.StrCulture.Equals("en-US")) { this.cbBCategoryAction.DisplayMember = dtCategory.Columns["CategoryActionName3"].ToString(); } else if (Common.clsLanguages.StrCulture.Equals("ja-JP")) { this.cbBCategoryAction.DisplayMember = dtCategory.Columns["CategoryActionName2"].ToString(); } this.cbBCategoryAction.ValueMember = dtCategory.Columns["CategoryActionID"].ToString(); this.cbBCategoryAction.SelectedIndex = 1; } #endregion End CategoryAction //End Linh 25-12-2014 //load data for cbb Employee DataTable dtEmployee = new DataTable(); dtEmployee = employeeBLL.GetLists(); if (dtEmployee != null) { this.cbbCurator.DataSource = dtEmployee; this.cbbCurator.DisplayMember = dtEmployee.Columns["EmployeeName"].ToString(); this.cbbCurator.ValueMember = dtEmployee.Columns["EmployeeId"].ToString(); } if (staticmemberId == null) { blag = true; this.cbbNationality.SelectedIndex = 0; this.chbIsLock.Visible = false; this.dtpLockDate.Visible = false; this.lblLockDate.Visible = false; try { cbbCurator.SelectedValue = Program.employee1.EmployeeId; } catch (Exception) { } } else { Entities.Member member = new Entities.Member(); member = memberBLL.GetById(staticmemberId); this.txtMemberCode.Text = member.MemberCode; this.txtMemerName.Text = member.MemberName; if (member.birthDay == true) { this.chkNgaySinh.Checked = true; dtpBirthDate.Enabled = true; } else { this.chkNgaySinh.Checked = false; dtpBirthDate.Enabled = false; } this.txtChucDanh.Text = member.Regency; this.dtpBirthDate.Value = member.BirthDate; this.txtEmail.Text = member.Email; this.txtPhoneNumber.Text = member.PhoneNumber; this.txtAddress.Text = member.Address; this.cbbNationality.SelectedValue = member.Country.CountryId; this.txtTotalScore.Text = member.TotalScore.ToString(); this.txtNumberOfVissits.Text = member.NumberOfVissits.ToString(); this.dtpLastDate.Value = member.LastestDate; this.dtpCreatedDate.Value = member.CreatedDate; this.dtpUpdatedDate.Value = member.UpdatedDate; //Linh 29-12-2014 try { this.cbbCurator.SelectedValue = member.Curator.EmployeeId; this.cbBCategoryAction.SelectedValue = member.CategoryID.CategoryActionID; } catch (Exception) { this.cbbCurator.SelectedValue = Program.employee1.EmployeeId; this.cbBCategoryAction.SelectedIndex = 1; } //Điệp edit this.txtCurrentScore.Text = member.CurrentScore.ToString(); List <string> lstMemberTypeName = new List <string>(); /// List <int> lst_mbt = new List <int>(); if (member.List_MemberType != null) { foreach (Entities.MemberType mt in member.List_MemberType) { lst_mbt.Add(mt.MemberTypeId); } } lstMemberTypeName = memberTypeBLL.GetListMemberTypeName_New(lst_mbt); for (int i = 0; i < lstMemberType.Items.Count; i++) { /* string[] arr = lstMemberType.GetItemText(lstMemberType.Items[i]).Split('/'); * for (int j = 0; j < lstMemberTypeName.Count; j++) * { * if (arr[0].Equals(lstMemberTypeName[j])) * { * lstMemberType.SetItemChecked(i, true); * break; * } * } */ int index = int.Parse(((DataRowView)lstMemberType.Items[i])["MemberTypeId"].ToString()); if (lst_mbt.Contains(index)) { lstMemberType.SetItemChecked(i, true); } } if (member.IsLock == 1) { chbIsLock.Checked = true; lblLockDate.Visible = true; dtpLockDate.Visible = true; } else { lblLockDate.Visible = false; dtpLockDate.Visible = false; } if (member.LockDate != new DateTime()) { this.dtpLockDate.Value = member.LockDate; } //Điệp Add 20140418 this.txtMobilePhone.Text = member.MobilePhone; this.txtWebsite.Text = member.Website; this.txtTaxCode.Text = member.TaxCode; this.txtCompanyName.Text = member.CompanyName; this.txtDescription.Text = System.Text.RegularExpressions.Regex.Replace(member.Description, "\n", "\r\n"); if (!Common.clsLanguages.StrCulture.Equals("ja-JP")) { this.cbBCallName.SelectedValue = member.CallName.CallNameID; } this.txtCompanyEmail.Text = member.Email; //End Điệp add 20140418 } }