Exemplo n.º 1
0
        /// <summary>
        /// Load data for form
        /// </summary>
        private void LoadData()
        {
            #region ComboBox cbb CategoryActions
            DataTable dtCategory = new DataTable();
            dtCategory = categoryactionsBLL.GetLists();
            DataRow row1 = dtCategory.NewRow();
            row1["CategoryActionID"]    = "";
            row1["CategoryActionName"]  = Common.clsLanguages.GetResource("CRMSelectAll");
            row1["CategoryActionName3"] = Common.clsLanguages.GetResource("CRMSelectAll");
            row1["CategoryActionName2"] = Common.clsLanguages.GetResource("CRMSelectAll");
            dtCategory.Rows.Add(row1);
            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();

                cbBCategoryAction.SelectedIndex = dtCategory.Rows.IndexOf(row1);
            }

            #endregion End CategoryAction

            #region ComboBox ActionStatus
            DataTable dtActions = new DataTable();
            dtActions = actionstatusBLL.GetLists();
            DataRow row2 = dtActions.NewRow();
            row2["ActionStatusID"] = "";
            row2["ActionName2"]    = Common.clsLanguages.GetResource("CRMSelectAll");
            row2["ActionName3"]    = Common.clsLanguages.GetResource("CRMSelectAll");
            row2["ActionName"]     = Common.clsLanguages.GetResource("CRMSelectAll");
            dtActions.Rows.Add(row2);
            if (dtActions != null)
            {
                this.cbbActionStatus.DataSource = dtActions;
                if (Common.clsLanguages.StrCulture.Equals("vi-VN"))
                {
                    this.cbbActionStatus.DisplayMember = dtActions.Columns["ActionName"].ToString();
                }
                else if (Common.clsLanguages.StrCulture.Equals("en-US"))
                {
                    this.cbbActionStatus.DisplayMember = dtActions.Columns["ActionName3"].ToString();
                }
                else if (Common.clsLanguages.StrCulture.Equals("ja-JP"))
                {
                    this.cbbActionStatus.DisplayMember = dtActions.Columns["ActionName2"].ToString();
                }
                this.cbbActionStatus.ValueMember = dtActions.Columns["ActionStatusID"].ToString();
                cbbActionStatus.SelectedIndex    = dtActions.Rows.IndexOf(row2);
            }

            #endregion End ActionStatus

            # region CoboBox data for cbBUserActionNext
            //DataTable dtEmployee2 = new DataTable();
            //dtEmployee2 = employeeBLL.GetLists();
            //if (dtEmployee2 != null)
            //{
            //    this.cbBUserActionNext.DataSource = dtEmployee2;

            //    DataRow row = dtEmployee2.NewRow();
            //    row["EmployeeName"] = "";
            //    dtEmployee2.Rows.InsertAt(row, 0);
            //    cbBUserActionNext.SelectedIndex = 0;

            //    cbBUserActionNext.DisplayMember = "EmployeeName";
            //    cbBUserActionNext.ValueMember = "EmployeeId";

            //}
            #endregion End ComboBox cbBUserActionID

            # region CoboBox data for  cbBPriority
Exemplo n.º 2
0
        /// <summary>
        /// Load data for form
        /// </summary>
        private void LoadData()
        {
            //setLoadGridView();
            DataSet   ds = memberBLL.GetInfoForFrmManageMembers();
            DataTable dt = new DataTable();

            lstMemberTypes.Items.Clear();
            dt = ds.Tables[0];
            if (dt != null)
            {
                lstMemberTypes.DataSource = dt;

                if (Common.clsLanguages.StrCulture.Equals("vi-VN"))
                {
                    lstMemberTypes.DisplayMember = dt.Columns["MemberTypeName"].ToString();
                }
                else if (Common.clsLanguages.StrCulture.Equals("en-US"))
                {
                    lstMemberTypes.DisplayMember = dt.Columns["MemberTypeName3"].ToString();
                }
                else if (Common.clsLanguages.StrCulture.Equals("ja-JP"))
                {
                    lstMemberTypes.DisplayMember = dt.Columns["MemberTypeName2"].ToString();
                }

                lstMemberTypes.ValueMember = dt.Columns["MemberTypeId"].ToString();
            }

            DataTable dtCountries = new DataTable();

            dtCountries = ds.Tables[1];
            if (dtCountries != null)
            {
                cbbNationality.DataSource = dtCountries;
                DataRow defaultRow = dtCountries.NewRow();
                defaultRow["CountryId"]    = "-1";
                defaultRow["CountryName"]  = Common.clsLanguages.GetResource("CRMSelectAll");
                defaultRow["CountryName2"] = Common.clsLanguages.GetResource("CRMSelectAll");
                defaultRow["CountryName3"] = Common.clsLanguages.GetResource("CRMSelectAll");
                dtCountries.Rows.Add(defaultRow);
                if (Common.clsLanguages.StrCulture.Equals("vi-VN"))
                {
                    cbbNationality.DisplayMember = dtCountries.Columns["CountryName"].ToString();
                }
                else if (Common.clsLanguages.StrCulture.Equals("en-US"))
                {
                    cbbNationality.DisplayMember = dtCountries.Columns["CountryName3"].ToString();
                }
                else if (Common.clsLanguages.StrCulture.Equals("ja-JP"))
                {
                    cbbNationality.DisplayMember = dtCountries.Columns["CountryName2"].ToString();
                }
                cbbNationality.ValueMember   = dtCountries.Columns["CountryId"].ToString();
                cbbNationality.SelectedIndex = dtCountries.Rows.IndexOf(defaultRow);
            }

            //Load data for combox creator
            DataTable dtCreator = new DataTable();

            //dtCreator = employeeBLL.GetLists();
            dtCreator = ds.Tables[2];
            if (dtCreator != null)
            {
                //add default row - Nghi
                DataRow defaultRow = dtCreator.NewRow();
                defaultRow["EmployeeId"]   = "-1";
                defaultRow["EmployeeName"] = Common.clsLanguages.GetResource("CRMSelectAll");

                dtCreator.Rows.Add(defaultRow);

                //cbbCreator.DataSource = dtCreator;
                //cbbCreator.DisplayMember = dtCreator.Columns["EmployeeName"].ToString();
                //cbbCreator.ValueMember = dtCreator.Columns["EmployeeId"].ToString();
                //cbbCreator.SelectedIndex = dtCreator.Rows.IndexOf(defaultRow);

                //Linh 24-12-2014

                cbbCurator.DataSource    = dtCreator;
                cbbCurator.DisplayMember = dtCreator.Columns["EmployeeName"].ToString();
                cbbCurator.ValueMember   = dtCreator.Columns["EmployeeId"].ToString();
                cbbCurator.SelectedIndex = dtCreator.Rows.IndexOf(defaultRow);
            }

            #region ComboBox cbb CategoryActions
            DataTable dtCategory = new DataTable();
            dtCategory = categoryactionsBLL.GetLists();
            DataRow row1 = dtCategory.NewRow();
            row1["CategoryActionID"]    = "-1";
            row1["CategoryActionName"]  = Common.clsLanguages.GetResource("CRMSelectAll");
            row1["CategoryActionName3"] = Common.clsLanguages.GetResource("CRMSelectAll");
            row1["CategoryActionName2"] = Common.clsLanguages.GetResource("CRMSelectAll");
            dtCategory.Rows.Add(row1);
            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();

                cbBCategoryAction.SelectedIndex = dtCategory.Rows.IndexOf(row1);
            }

            #endregion End CategoryAction

            this.dtpBirthDate1.Value = DateTime.Now;
            this.dtpBirthDate2.Value = DateTime.Now;
        }
Exemplo n.º 3
0
 ///// <summary>
 ///// Get data from table Custommer_Type
 ///// </summary>
 private void GetLists_InGridClassification()
 {
     dgvClassification.DataSource = classifications.GetLists();
     txtClassificationName.Focus();
 }
Exemplo n.º 4
0
        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
            }
        }
Exemplo n.º 5
0
        //Load dữ liện lên form
        public void LoadData()
        {
            #region    ComboBox  load member
            DataTable dt = new DataTable();
            dt = memberBLL.GetListNameOrCompany();
            if (dt != null)
            {
                cbBCustomID.DataSource    = dt;
                cbBCustomID.DisplayMember = dt.Columns["MemberName"].ToString();
                cbBCustomID.ValueMember   = dt.Columns["MemberId"].ToString();
            }

            #endregion End load member

            #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();
            }

            #endregion End CategoryAction

            #region ComboBox ActionStatus
            DataTable dtActions = new DataTable();
            dtActions = actionstatusBLL.GetLists();
            if (dtActions != null)
            {
                this.cbbActionStatus.DataSource = dtActions;
                if (Common.clsLanguages.StrCulture.Equals("vi-VN"))
                {
                    this.cbbActionStatus.DisplayMember = dtActions.Columns["ActionName"].ToString();
                }
                else if (Common.clsLanguages.StrCulture.Equals("en-US"))
                {
                    this.cbbActionStatus.DisplayMember = dtActions.Columns["ActionName3"].ToString();
                }
                else if (Common.clsLanguages.StrCulture.Equals("ja-JP"))
                {
                    this.cbbActionStatus.DisplayMember = dtActions.Columns["ActionName2"].ToString();
                }
                this.cbbActionStatus.ValueMember = dtActions.Columns["ActionStatusID"].ToString();
            }

            #endregion End ActionStatus

            # region CoboBox data for cbbCreator
            //DataTable dtEmployee = new DataTable();
            //dtEmployee = employeeBLL.GetLists();
            //if (dtEmployee != null)
            //{
            //    this.cbbCreator.DataSource = dtEmployee;
            //    cbbCreator.DisplayMember = "EmployeeName";
            //    cbbCreator.ValueMember = "EmployeeId";
            //}
            #endregion End ComboBox Employee

            # region CoboBox data for cbBUserActionID
            //DataTable dtEmployee2 = new DataTable();
            //dtEmployee2 = employeeBLL.GetLists();
            //if (dtEmployee2 != null)
            //{
            //    this.cbBUserActionID.DataSource = dtEmployee2;
            //    cbBUserActionID.DisplayMember = "EmployeeName";
            //    cbBUserActionID.ValueMember = "EmployeeId";

            //}
            #endregion End ComboBox cbBUserActionID

            # region CoboBox data for cbBUserActionNext
            //DataTable dtEmployee3 = new DataTable();
            //dtEmployee3 = employeeBLL.GetLists();
            //if (dtEmployee3 != null)
            //{
            //    this.cbBUserActionNext.DataSource = dtEmployee3;

            //    DataRow row = dtEmployee3.NewRow();
            //    row["EmployeeName"] = "";
            //    dtEmployee3.Rows.InsertAt(row, 0);
            //    cbBUserActionNext.SelectedIndex = 0;

            //    cbBUserActionNext.DisplayMember = "EmployeeName";
            //    cbBUserActionNext.ValueMember = "EmployeeId";


            //}
            #endregion End ComboBox  cbBUserActionNext

            # region CoboBox data for  cbBPriority