Esempio n. 1
0
        private void UpdateDgvFields()
        {
            for (int i = 0; i < this.dtEmployees.Rows.Count; i++)
            {
                this.dgvEmployees.Rows[i].Cells["intDepartmentAsName"].Value =
                    Department.GetNameByNumber(cnConnection, (int)this.dgvEmployees.Rows[i].Cells["intDepartment"].Value);

                SubDepartment sdSubDepartment = new SubDepartment();
                sdSubDepartment.intDepartmnt = (int)this.dgvEmployees.Rows[i].Cells["intDepartment"].Value;
                sdSubDepartment.intNumber    = (int)this.dgvEmployees.Rows[i].Cells["intSubDepartment"].Value;
                this.dgvEmployees.Rows[i].Cells["intSubDepartmentAsName"].Value =
                    SubDepartment.GetNameByNumber(cnConnection, sdSubDepartment.intDepartmnt, sdSubDepartment.intNumber);

                this.dgvEmployees.Rows[i].Cells["intSubdepartmentSubsetAsName"].Value =
                    SubDepartmentSubset.GetNameByNumber(cnConnection, (int)this.dgvEmployees.Rows[i].Cells["intSubdepartmentSubset"].Value);

                this.dgvEmployees.Rows[i].Cells["intEducationLevelAsName"].Value = (Employee.EducationLevel) this.dgvEmployees.Rows[i].Cells["intEducationLevel"].Value;

                this.dgvEmployees.Rows[i].Cells["intEmploymentTypeAsName"].Value = (Employee.EmploymentType) this.dgvEmployees.Rows[i].Cells["intEmploymentType"].Value;

                this.dgvEmployees.Rows[i].Cells["intPostAsName"].Value =
                    Post.GetNameByNumber(this.cnConnection, (int)this.dgvEmployees.Rows[i].Cells["intPost"].Value);

                if ((bool)this.dgvEmployees.Rows[i].Cells["bitIsShiftMode"].Value)
                {
                    this.dgvEmployees.Rows[i].Cells["bitIsShiftModeAsName"].Value = "بله";
                }
                else
                {
                    this.dgvEmployees.Rows[i].Cells["bitIsShiftModeAsName"].Value = "خیر";
                }

                if ((bool)this.dgvEmployees.Rows[i].Cells["bitIsLeader"].Value)
                {
                    this.dgvEmployees.Rows[i].Cells["bitIsLeaderAsName"].Value = "بله";
                }
                else
                {
                    this.dgvEmployees.Rows[i].Cells["bitIsLeaderAsName"].Value = "خیر";
                }

                if ((int)this.dgvEmployees.Rows[i].Cells["intShiftType"].Value == -1)
                {
                    this.dgvEmployees.Rows[i].Cells["intShiftTypeAsName"].Value = "-";
                }
                else
                {
                    this.dgvEmployees.Rows[i].Cells["intShiftTypeAsName"].Value =
                        ((ShiftInfo.ShiftType) this.dgvEmployees.Rows[i].Cells["intShiftType"].Value).ToString();
                }
            }
        }
        private void EmployeeUpdate_Load(object sender, EventArgs e)
        {
            //Fill cbDepartments ComboBox
            this.depDepartments = Department.GetDepartments(this.cnConnection);
            foreach (Department depDepartment in this.depDepartments)
            {
                this.cbDepartments.Items.Add(depDepartment.strName);
            }

            //Fill cbSubDepartment
            this.depSubDepartments = SubDepartment.GetSubDepartments(this.cnConnection, this.emUpdate.intDepartment);
            foreach (SubDepartment depSubDepartment in this.depSubDepartments)
            {
                this.cbSubDepartment.Items.Add(depSubDepartment.strName);
            }

            //Fill cbSubDepartmentSubset
            this.depSubDepartmentSubsets = SubDepartmentSubset.GetSubDepartmentSubsets(this.cnConnection, this.emUpdate.intSubDepartment);
            foreach (SubDepartmentSubset depSubDepartmentSubset in this.depSubDepartmentSubsets)
            {
                this.cbSubDepartmentSubset.Items.Add(depSubDepartmentSubset.strName);
            }

            //Next Corporation ID
            this.tbCoID.Text = Employee.GetNextCoId(this.cnConnection);

            //Fill cbShiftType
            this.cbShiftType.DataSource    = Enum.GetValues(typeof(ShiftInfo.ShiftType));
            this.cbShiftType.SelectedIndex = -1;

            //Fill cbPosts
            this.cbPosts.DataSource    = Enum.GetValues(typeof(Employee.PostType));
            this.cbPosts.SelectedIndex = -1;

            //Fill cbEmploymentTypes
            this.cbEmploymentTypes.DataSource    = Enum.GetValues(typeof(Employee.EmploymentType));
            this.cbEmploymentTypes.SelectedIndex = -1;

            //Fill cbEducationLevels
            this.cbEducationLevels.DataSource    = Enum.GetValues(typeof(Employee.EducationLevel));
            this.cbEducationLevels.SelectedIndex = -1;

            //Fill cbLocationProvince
            this.cbLocationProvince.DataSource    = Employee.GetProvinces(this.cnConnection);
            this.cbLocationProvince.SelectedIndex = -1;

            //Fill cbBankName
            this.dtBankNames              = Banking.GetBankNames(this.cnConnection);
            this.cbBankName.DataSource    = this.dtBankNames;
            this.cbBankName.DisplayMember = "nvcName";
            this.cbBankName.SelectedIndex = -1;

            this.tbCoID.Text                = this.emUpdate.strCoID;
            this.tbFirstName.Text           = this.emUpdate.strFirstName;
            this.tbLastName.Text            = this.emUpdate.strLastName;
            this.tbNationalID.Text          = this.emUpdate.strNationalID;
            this.tbInsuranceNumber.Text     = this.emUpdate.strInsuranceNumber;
            this.dtpBrightDate.Value        = this.emUpdate.dtBirth;
            this.cbIsShiftMode.Checked      = this.emUpdate.bolIsShiftMode;
            this.cbShiftType.Text           = ((ShiftInfo.ShiftType) this.emUpdate.intShiftType).ToString();
            this.tbWorkGroup.Text           = this.emUpdate.intWorkGroup.ToString();
            this.cbIsLeader.Checked         = this.emUpdate.bolIsLeader;
            this.tbPhoneNumber.Text         = this.emUpdate.strPhoneNumber;
            this.tbFatherName.Text          = this.emUpdate.strFatherName;
            this.dtpBrightDate.Value        = this.emUpdate.dtBirth;
            this.cbDepartments.Text         = Department.GetNameByNumber(this.cnConnection, this.emUpdate.intDepartment);
            this.cbSubDepartment.Text       = SubDepartment.GetNameByNumber(this.cnConnection, this.emUpdate.intDepartment, this.emUpdate.intSubDepartment);
            this.cbSubDepartmentSubset.Text = SubDepartmentSubset.GetNameByNumber(this.cnConnection, this.emUpdate.intSubDepartmentSubset);
            this.cbPosts.Text               = ((Employee.PostType) this.emUpdate.intPost).ToString();
            this.cbEmploymentTypes.Text     = ((Employee.EmploymentType) this.emUpdate.intEmploymentType).ToString();
            this.cbBankName.Text            = this.emUpdate.bnkInfo.strBankName;
            this.tbBankAccount.Text         = this.emUpdate.bnkInfo.strBankAccount;
            this.tbBankShaba.Text           = this.emUpdate.bnkInfo.strBankShaba;
            this.tbBankAtmCard.Text         = this.emUpdate.bnkInfo.strBankAtmCard;
            this.cbEducationLevels.Text     = ((Employee.EducationLevel) this.emUpdate.intEducationLevel).ToString();
            this.cbLocationProvince.Text    = this.emUpdate.strLocationProvince;
            this.tbLocationCounty.Text      = this.emUpdate.strLocationCounty;
            this.tbLocationCityVillage.Text = this.emUpdate.strLocationCityVillage;
            this.tbLocationAddress.Text     = this.emUpdate.strLocationAddress;
            this.tbPostalCode.Text          = this.emUpdate.strPostalCode;

            SetEnableBtmOk();
        }