Example #1
0
 private void btnAudit2_Click(object sender, EventArgs e)
 {
     if (this.dtgList.SelectedRows.Count > 0)
     {
         var oModel = new PayOffLogic();
         if (MessageBox.Show("确定要审批通过吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
         {
             foreach (DataGridViewRow dgvr in this.dtgList.SelectedRows)
             {
                 oModel.Checkup(long.Parse(dgvr.Cells["id"].Value.ToString()), true, this.UserName);
             }
         }
         else
         {
             foreach (DataGridViewRow dgvr in this.dtgList.SelectedRows)
             {
                 oModel.Checkup(long.Parse(dgvr.Cells["id"].Value.ToString()), false, this.UserName);
             }
         }
         this.btnSearch_Click(null, null);
     }
     else
     {
         CommUI.AlertError("请选择数据行!");
     }
 }
Example #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.txtNo.Text.Trim() == "")
            {
                CommUI.AlertError("部门编码不能为空!");
                return;
            }
            if (this.txtName.Text.Trim() == "")
            {
                CommUI.AlertError("部门名称不能为空!");
                return;
            }
            Department oEntity = new Department();

            oEntity.no        = this.txtNo.Text.Trim();
            oEntity.name      = this.txtName.Text.Trim();
            oEntity.inputDate = DateTime.Now;
            oEntity.inputMan  = this.UserName;
            oEntity.remark    = this.txtMemo.Text;

            string strResult = new DepartmentLogic().Add(oEntity);

            if (string.IsNullOrEmpty(strResult) == false)
            {
                CommUI.AlertError(strResult);
                return;
            }
            this.txtNo.Text   = "";
            this.txtName.Text = "";
            this.txtMemo.Text = "";
            this.BindDataGrid();
        }
Example #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.dtsWillBeStore.Tables[0].Rows.Count <= 0)
            {
                return;
            }
            if (this.txtPayOffName.Text.Trim() == "")
            {
                CommUI.MsgOK("工资发放名称不能为空!");
                this.txtPayOffName.Focus();
                return;
            }
            PayOffLogic oExec = new PayOffLogic();

            if (oExec.IsExistPayName(this.txtPayOffName.Text.Trim()))
            {
                CommUI.AlertError("工资发放名称己经存在,请修改!");
                this.txtPayOffName.Focus();
                return;
            }

            PayOffDTS dtsPayOff = new PayOffDTS();

            foreach (DataRow oRow in this.dtsWillBeStore.Tables[0].Rows)
            {
                PayOffDTS.payOffGatherRow drPayOffGather = dtsPayOff.payOffGather.NewpayOffGatherRow();
                drPayOffGather.piId       = long.Parse(oRow["员工标识"].ToString());
                drPayOffGather.realIncome = decimal.Parse(oRow["实领工资"].ToString());
                drPayOffGather.month      = this.datePayOff.Value;
                drPayOffGather.inputDate  = DateTime.Now;
                drPayOffGather.cHumanName = oRow["员工姓名"].ToString();
                drPayOffGather.inputMan   = this.UserName;
                drPayOffGather.name       = this.txtPayOffName.Text.Trim();
                dtsPayOff.payOffGather.AddpayOffGatherRow(drPayOffGather);
                foreach (DataColumn oColumn in this.dtsWillBeStore.Tables[0].Columns)
                {
                    // 判断每一列是否为薪水项
                    PayRollItem oPayRollItem = this.strHeader.Where(arg => arg.Name == oColumn.ColumnName).FirstOrDefault();
                    if (oPayRollItem != null)
                    {
                        PayOffDTS.payOffDetailRow drPayOffDetail = dtsPayOff.payOffDetail.NewpayOffDetailRow();
                        drPayOffDetail.paid     = oPayRollItem.ID;
                        drPayOffDetail.piId     = drPayOffGather.piId;
                        drPayOffDetail.money    = oRow[oColumn].ToString() == "" ? 0m : decimal.Parse(oRow[oColumn].ToString());
                        drPayOffDetail.month    = drPayOffGather.month.Month;
                        drPayOffDetail.inputMan = this.UserName;
                        dtsPayOff.payOffDetail.AddpayOffDetailRow(drPayOffDetail);
                    }
                }
            }

            oExec.AddPayOff(dtsPayOff);
            CommUI.MsgOK();
            this.dtsWillBeStore.Tables[0].Rows.Clear();
        }
Example #4
0
        /// <summary>
        /// 单元格验证时发生
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dtgList_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            decimal newValue;

            if (this.dtgList.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null)
            {
                return;
            }

            if (this.dtgList.Columns[e.ColumnIndex].HeaderText == "基本工资" &&
                decimal.TryParse(e.FormattedValue.ToString().Trim(), out newValue) == false)
            {
                e.Cancel = true;
                CommUI.AlertError("请输入一个有效数值!");
            }
            DateTime d;

            if (this.dtgList.Columns[e.ColumnIndex].HeaderText == "出生日期" &&
                DateTime.TryParse(e.FormattedValue.ToString().Trim(), out d) == false)
            {
                e.Cancel = true;
                CommUI.AlertError("请输入一个有日期!");
            }
            if (this.dtgList.Columns[e.ColumnIndex].HeaderText == "职称评定时间" &&
                DateTime.TryParse(e.FormattedValue.ToString().Trim(), out d) == false)
            {
                e.Cancel = true;
                CommUI.AlertError("请输入一个有日期!");
            }
            if (this.dtgList.Columns[e.ColumnIndex].HeaderText == "参加工作时间" &&
                DateTime.TryParse(e.FormattedValue.ToString().Trim(), out d) == false)
            {
                e.Cancel = true;
                CommUI.AlertError("请输入一个有日期!");
            }
            if (this.dtgList.Columns[e.ColumnIndex].HeaderText == "入职日期" &&
                DateTime.TryParse(e.FormattedValue.ToString().Trim(), out d) == false)
            {
                e.Cancel = true;
                CommUI.AlertError("请输入一个有日期!");
            }
            if (this.dtgList.Columns[e.ColumnIndex].HeaderText == "离职时间" &&
                DateTime.TryParse(e.FormattedValue.ToString().Trim(), out d) == false)
            {
                e.Cancel = true;
                CommUI.AlertError("请输入一个有日期!");
            }
        }
Example #5
0
        private bool CheckForm()
        {
            var chkBoxs = panPayRoll_flp.Controls.OfType <CheckBox>().Where(p => p.Checked == true);

            if (chkBoxs.Count() == 0)
            {
                CommUI.AlertError("请您选择至少一个要发放的工资项!");
                return(false);
            }
            //没有选择增项
            var bIsAllMinus = panPayRoll_flp.Controls.OfType <CheckBox>().Where(p => p.Checked == true && (p.Tag as PayRollItem).IsMinus == false).Count() == 0;

            if (bIsAllMinus)
            {
                CommUI.AlertError("您目前选择的工资项无法发放,请再选择能够发放的工资项!");
                return(false);
            }
            string[] strInsuranceItems = new string[] { "养老保险", "医疗保险", "失业保险", "医疗大额保险", "住房公积金", "扣税" };
            //选中保险了,但没有选"基本工资"提示不能发放.
            bool bChkedInsurance = (from control in panPayRoll_flp.Controls.OfType <CheckBox>()
                                    where strInsuranceItems.Contains(control.Text) && control.Checked == true
                                    select control).Count() > 0;

            if (bChkedInsurance == true)
            {
                var chkBase = (from control in panPayRoll_flp.Controls.OfType <CheckBox>()
                               where control.Text == "基本工资"
                               select control).FirstOrDefault();
                if (chkBase == null)
                {
                    CommUI.AlertError("没有基本工资项,不能发放工资!");
                    return(false);
                }
                if (chkBase.Checked == false)
                {
                    if (CommUI.Confirm("发放保险或扣税必须选择基本工资项!") != DialogResult.OK)
                    {
                        return(false);
                    }
                    else
                    {
                        chkBase.Checked = true;
                    }
                }
            }
            return(true);
        }
Example #6
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (this.dtgList.SelectedRows.Count == 0)
            {
                CommUI.AlertError("请选择一条记录!");
                return;
            }
            var frmEdit = new FrmEmployeeInfoEdit();

            frmEdit.iHumanID = (this.dtgList.SelectedRows[0].DataBoundItem as PersonnelInfo).id;
            var result = frmEdit.ShowDialog();

            if (result == DialogResult.OK)
            {
                this.BindDataGrid();
            }
        }
Example #7
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtTemplateName.Text.Trim()))
            {
                CommUI.MsgOK("模板名称不能为空!");
                this.txtTemplateName.Focus();
                this.DialogResult = DialogResult.None;
                return;
            }
            SalaryItemTemplet entity = new SalaryItemTemplet();
            FrmReadyPayOff    pWin   = this.Owner.ActiveMdiChild as FrmReadyPayOff;
            //被选中的工资项
            var chkBoxs = pWin.panPayRoll_flp.Controls.OfType <CheckBox>().Where(p => p.Checked == true);
            //数据库中有多少个工资项字段
            var pItems = entity.GetType().GetProperties().Where(p => p.Name.StartsWith("item"));

            if (chkBoxs.Count() > pItems.Count())
            {
                CommUI.AlertError("您选的工资项太多,数据库不能存储,请偿试减少工资项!");
                return;
            }
            //设置工资模板的工资项
            for (int i = 0; i < chkBoxs.Count(); i++)
            {
                pItems.ElementAt(i).SetValue(entity, chkBoxs.ElementAt(i).Text, null);
            }

            entity.name      = this.txtTemplateName.Text.Trim();
            entity.inputDate = DateTime.Now;
            entity.inputMan  = this.UserName;
            string strResult = new PayRollTemplateLogic().AddTemplate(entity);

            if (string.IsNullOrEmpty(strResult))
            {
                //CommUI.MsgOK();
            }
            else
            {
                CommUI.AlertError(strResult);
            }
        }
Example #8
0
        private void btnDeletePosition_Click(object sender, EventArgs e)
        {
            if (this.dtgPosition.RowCount == 0 ||
                this.dtgPosition.SelectedRows.Count == 0)
            {
                return;
            }
            if (CommUI.Confirm("确定要删除吗?") == DialogResult.No)
            {
                return;
            }

            int[] rowsID = (from System.Windows.Forms.DataGridViewRow row in this.dtgPosition.SelectedRows
                            select int.Parse(row.Cells[0].Value.ToString())).ToArray <int>();

            if (rowsID.Length == 0)
            {
                try
                {
                    rowsID = new int[1] {
                        int.Parse(this.dtgPosition.CurrentRow.Cells[0].Value.ToString())
                    };
                }
                catch (System.Exception) { }
                if (rowsID.Length == 0)
                {
                    return;
                }
            }

            try
            {
                new EmployeeLogic().RemovePosition(rowsID);
            }
            catch
            {
                CommUI.AlertError("使用中的职位无法删除!");
            }
            this.BindPosition();
        }
Example #9
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.dtgList.RowCount == 0 ||
                this.dtgList.SelectedRows.Count == 0)
            {
                return;
            }
            if (MessageBox.Show("确定要删除吗?", "请确认", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            int[] rowsID = (from System.Windows.Forms.DataGridViewRow row in this.dtgList.SelectedRows
                            select int.Parse(row.Cells[0].Value.ToString())).ToArray <int>();

            if (rowsID.Length == 0)
            {
                try
                {
                    rowsID = new int[1] {
                        int.Parse(this.dtgList.CurrentRow.Cells[0].Value.ToString())
                    };
                }
                catch (System.Exception) { }
                if (rowsID.Length == 0)
                {
                    return;
                }
            }
            try
            {
                new DepartmentLogic().Remove(rowsID);
            }
            catch
            {
                CommUI.AlertError("使用中的部门无法删除!");
            }
            this.BindDataGrid();
        }
Example #10
0
        private void btnOKPosition_Click(object sender, EventArgs e)
        {
            if (this.txtPositionName.Text.Trim() == "")
            {
                CommUI.AlertError("职位名称不能为空!");
                return;
            }
            Position oEntity = new Position();

            oEntity.inputDate = DateTime.Now;
            oEntity.inputMan  = this.UserName;
            oEntity.name      = this.txtPositionName.Text;
            string strResult = new EmployeeLogic().AddPosition(oEntity);

            if (string.IsNullOrEmpty(strResult) == false)
            {
                CommUI.AlertError(strResult);
                return;
            }
            this.txtPositionName.Text = "";
            this.BindPosition();
        }
Example #11
0
        private void btnOKYield_Click(object sender, EventArgs e)
        {
            if (this.txtYieldName.Text.Trim() == "")
            {
                CommUI.AlertError("生产班组名称不能为空!");
                return;
            }
            if (this.cboDepartment.Text.Trim() == "")
            {
                CommUI.AlertError("部门不能为空!");
                return;
            }
            if (this.cboEPInfo.Text.Trim() == "")
            {
                CommUI.AlertError("设备不能为空!");
                return;
            }
            ProduceTeam oEntity = new ProduceTeam();

            oEntity.name      = this.txtYieldName.Text.Trim();
            oEntity.did       = long.Parse(this.cboDepartment.SelectedValue.ToString());
            oEntity.count     = long.Parse(this.txtPersonalCount.Text);
            oEntity.inputDate = DateTime.Now;
            oEntity.inputMan  = this.UserName;
            oEntity.remark    = this.txtYieldMemo.Text;
            oEntity.eiId      = long.Parse(this.cboEPInfo.SelectedValue.ToString());

            string strResult = new EmployeeLogic().AddYieldGroup(oEntity);

            if (string.IsNullOrEmpty(strResult) == false)
            {
                CommUI.AlertError(strResult);
                return;
            }
            this.txtYieldName.Text     = "";
            this.txtYieldMemo.Text     = "";
            this.txtPersonalCount.Text = "10";
            this.BindYieldGroup();
        }
Example #12
0
        private bool CheckForm()
        {
            if (string.IsNullOrEmpty(this.txtNo.Text.Trim()))
            {
                CommUI.AlertError("职工编号不能为空!");
                return(false);
            }
            if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
            {
                CommUI.AlertError("职工姓名不能为空!");
                return(false);
            }
            if (string.IsNullOrEmpty(this.txt身份证.Text.Trim()))
            {
                CommUI.AlertError("身份证号不能为空!");
                return(false);
            }
            if (string.IsNullOrEmpty(this.txt民族.Text.Trim()))
            {
                CommUI.AlertError("民族不能为空!");
                return(false);
            }
            if (string.IsNullOrEmpty(this.txt基本工资.Text.Trim()))
            {
                CommUI.AlertError("基本工资不能为空!");
                return(false);
            }
            decimal newValue;

            if (decimal.TryParse(this.txt基本工资.Text.Trim(), out newValue) == false)
            {
                CommUI.AlertError("请在基本工资项输入一个有效数值!");
                return(false);
            }
            return(true);
        }
Example #13
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();
                }
            }
        }