Пример #1
0
        private void InitForm()
        {
            List <Department> datasource = new DepartmentLogic().GetDepartMents();

            this.部门数据源.DataSource    = datasource;
            this.cbo部门.DisplayMember = "name";
            this.cbo部门.ValueMember   = "id";
            this.cbo部门.DataSource    = this.部门数据源;

            this.comboBox1.DisplayMember = "name";
            this.comboBox1.ValueMember   = "id";
            this.comboBox1.DataSource    = this.部门数据源;
            this.comboBox1.SelectedIndex = -1;


            DasherStation.system.SystemLogic p = new DasherStation.system.SystemLogic();
            p.InitialCbxDuty(this.cbo职位);
            this.cbo职位.DisplayMember = "name";
            this.cbo职位.ValueMember   = "id";

            if (this.cbo部门.Items.Count > 0)
            {
                var yieldGroups = new EmployeeLogic().GetYieldGroupByDepID(long.Parse(this.cbo部门.SelectedValue.ToString()));
                yieldGroups.Insert(0, new ProduceTeam()
                {
                    id = 0, name = ""
                });
                this.cbo生产班组.DataSource    = yieldGroups;
                this.cbo生产班组.DisplayMember = "name";
                this.cbo生产班组.ValueMember   = "id";
            }

            this.dtgList.AutoGenerateColumns = false;

            this.员工类别数据源.Add(new CKind()
            {
                TypeID = false, TypeName = "正式员工"
            });
            this.员工类别数据源.Add(new CKind()
            {
                TypeID = true, TypeName = "临时员工"
            });

            this.是否纳税数据源.Add(new CMark()
            {
                IsMark = false, Mark = "不纳税"
            });
            this.是否纳税数据源.Add(new CMark()
            {
                IsMark = true, Mark = "纳税"
            });


            this.Column23.DataSource    = this.部门数据源;
            this.Column23.DisplayMember = "name";
            this.Column23.ValueMember   = "id";

            this.职位数据源.DataSource       = this.cbo职位.DataSource;
            this.Column24.DataSource    = this.职位数据源;
            this.Column24.DisplayMember = "name";
            this.Column24.ValueMember   = "id";

            this.生产班组数据源.DataSource     = this.cbo生产班组.DataSource;
            this.Column25.DataSource    = this.生产班组数据源;
            this.Column25.DisplayMember = "name";
            this.Column25.ValueMember   = "id";
        }
Пример #2
0
        private void InitForm()
        {
            PersonnelInfo     oEntity    = new EmployeeLogic().GetEmployeeByID(this.iHumanID);
            List <Department> datasource = new DepartmentLogic().GetDepartMents();

            this.cbo部门.DisplayMember = "name";
            this.cbo部门.ValueMember   = "id";
            this.cbo部门.DataSource    = datasource;
            if (oEntity.dId.HasValue)
            {
                this.cbo部门.SelectedValue = oEntity.dId;
            }


            DasherStation.system.SystemLogic p = new DasherStation.system.SystemLogic();
            this.cbo职位.DisplayMember = "name";
            this.cbo职位.ValueMember   = "id";
            p.InitialCbxDuty(this.cbo职位);
            if (oEntity.pId.HasValue)
            {
                this.cbo职位.SelectedValue = oEntity.pId;
            }


            if (this.cbo部门.Items.Count > 0)
            {
                var yieldGroups = new EmployeeLogic().GetYieldGroupByDepID(long.Parse(this.cbo部门.SelectedValue.ToString()));
                yieldGroups.Insert(0, new ProduceTeam()
                {
                    id = 0, name = ""
                });
                this.cbo生产班组.DataSource    = yieldGroups;
                this.cbo生产班组.DisplayMember = "name";
                this.cbo生产班组.ValueMember   = "id";
                if (oEntity.ptId.HasValue)
                {
                    this.cbo生产班组.SelectedValue = oEntity.ptId.Value;
                }
            }


            this.txtNo.Text   = oEntity.no;
            this.txtName.Text = oEntity.name;
            if (oEntity.sex == "男")
            {
                this.radMan.Checked = true;
            }
            else
            {
                this.radWoman.Checked = true;
            }
            if (oEntity.judgeMarry == "己婚")
            {
                this.rad己婚.Checked = true;
            }
            else
            {
                this.rad未婚.Checked = true;
            }
            this.txt政治.Text = oEntity.politicalVisage;
            if (oEntity.birthday.HasValue)
            {
                this.dBirthday.Value = oEntity.birthday.Value;
            }
            this.txt学位.Text   = oEntity.tiptopDegree;
            this.txt专业.Text   = oEntity.specialty;
            this.txt资格证书.Text = oEntity.competencyCertificate;
            this.txt身份证.Text  = oEntity.IDCard;
            this.txt联系方式.Text = oEntity.contactMethod;
            this.txt民族.Text   = oEntity.nationality;
            this.txt合同编号.Text = oEntity.contractNo;
            this.txt家庭住址.Text = oEntity.address;
            this.txt职称.Text   = oEntity.function;
            if (oEntity.functionAssessDate.HasValue)
            {
                this.d职称评定时间.Value = oEntity.functionAssessDate.Value;
            }
            this.txt籍贯.Text = oEntity.nativePlace;
            if (oEntity.startWorkDate.HasValue)
            {
                this.d参加工作时间.Value = oEntity.startWorkDate.Value;
            }
            if (oEntity.salaryMethod == "日薪")
            {
                this.rad日薪.Checked = true;
            }
            else
            {
                this.rad月薪.Checked = true;
            }
            this.txt简历.Text = oEntity.resume;
            this.txt奖惩.Text = oEntity.hortationCastigate;
            if (oEntity.dimissionDate.HasValue)
            {
                this.d离职时间.Value = oEntity.dimissionDate.Value;
            }
            this.txt离职原因.Text = oEntity.dimissionReason;
            if (oEntity.workDate.HasValue)
            {
                this.d入职时间.Value = oEntity.workDate.Value;
            }
            this.txt备注.Text = oEntity.remark;
            if (oEntity.kind.Value)
            {
                this.radEmployee.Checked = true;
            }
            else
            {
                this.radTemporary.Checked = true;
            }
            if (oEntity.mark.Value)
            {
                this.rad纳税.Checked = true;
            }
            else
            {
                this.rad不纳税.Checked = true;
            }

            this.txt基本工资.Text = oEntity.basicSalary.ToString();
        }
Пример #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (CheckForm())
            {
                PersonnelInfo entity = new PersonnelInfo();
                entity.no                    = this.txtNo.Text.Trim();
                entity.name                  = this.txtName.Text.Trim();
                entity.sex                   = this.radMan.Checked ? "男" : "女";
                entity.judgeMarry            = this.rad己婚.Checked ? "己婚" : "未婚";
                entity.politicalVisage       = this.txt政治.Text.Trim();
                entity.birthday              = this.dBirthday.Value;
                entity.tiptopDegree          = this.txt学位.Text.Trim();
                entity.specialty             = this.txt专业.Text.Trim();
                entity.competencyCertificate = this.txt资格证书.Text.Trim();
                entity.IDCard                = this.txt身份证.Text.Trim();
                entity.contactMethod         = this.txt联系方式.Text.Trim();
                entity.nationality           = this.txt民族.Text.Trim();
                entity.contractNo            = this.txt合同编号.Text.Trim();
                entity.address               = this.txt家庭住址.Text.Trim();
                entity.function              = this.txt职称.Text.Trim();
                entity.functionAssessDate    = this.d职称评定时间.Value;
                entity.nativePlace           = this.txt籍贯.Text.Trim();
                if (this.cbo部门.Text.Trim() != "")
                {
                    entity.dId = long.Parse(this.cbo部门.SelectedValue.ToString());
                }
                entity.startWorkDate      = this.d参加工作时间.Value;
                entity.salaryMethod       = this.rad月薪.Checked == false ? "日薪" : "月薪";
                entity.resume             = this.txt简历.Text;
                entity.hortationCastigate = this.txt奖惩.Text.Trim();
                entity.dimissionDate      = this.d离职时间.Value;
                entity.dimissionReason    = this.txt离职原因.Text.Trim();
                entity.workDate           = this.d入职时间.Value;
                entity.remark             = this.txt备注.Text;

                entity.inputMan  = this.UserName;
                entity.inputDate = DateTime.Now;
                entity.kind      = this.radEmployee.Checked ? true : false;
                if (this.cbo生产班组.Text.Trim() != "")
                {
                    entity.ptId = long.Parse(this.cbo生产班组.SelectedValue.ToString());
                }
                entity.mark        = this.rad纳税.Checked ? true : false;
                entity.basicSalary = decimal.Parse(this.txt基本工资.Text.Trim());
                if (this.cbo职位.Text.Trim() != "")
                {
                    entity.pId = long.Parse(this.cbo职位.SelectedValue.ToString());
                }

                string strResult = new EmployeeLogic().Add(entity);
                if (!string.IsNullOrEmpty(strResult))
                {
                    CommUI.AlertError(strResult);
                }
                else
                {
                    //CommUI.MsgOK();
                    foreach (TextBox t in this.groupBox1.Controls.OfType <TextBox>())
                    {
                        t.Text = "";
                    }
                    this.BindDataGrid();
                }
            }
        }