Esempio n. 1
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();
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public PayRollItem[] QueryPayRollItems()
        {
            string    strSQL   = @"select id,name,kind,mark,minusPlace from PayrollAdd";
            ArrayList sqlArray = new ArrayList();

            System.Data.DataSet dtsResult = null;
            sqlArray.Add(strSQL);
            try
            {
                dtsResult = this.oSqlHelper.QueryForDateSet(sqlArray);
            }
            catch (System.Data.SqlClient.SqlException)
            {
                return(null);
            }
            if (dtsResult.Tables[0].Rows.Count == 0)
            {
                return(null);
            }
            PayRollItem[] oReturnValue = new PayRollItem[dtsResult.Tables[0].Rows.Count];
            for (int i = 0; i < dtsResult.Tables[0].Rows.Count; i++)
            {
                System.Data.DataRow row = dtsResult.Tables[0].Rows[i];
                var item = new PayRollItem();
                item.ID   = Int32.Parse(row["id"].ToString());
                item.Name = row["name"].ToString();
                object oEmployeeType = row["kind"];
                if (oEmployeeType.ToString() == "0")
                {
                    item.EmployeeType = EnumEmployeeType.Official;
                }
                else if (oEmployeeType.ToString() == "1")
                {
                    item.EmployeeType = EnumEmployeeType.Temp;
                }
                else if (oEmployeeType.ToString() == "2")
                {
                    item.EmployeeType = EnumEmployeeType.Staff;
                }
                item.IsMinus      = row["mark"].ToString().ToLower() == "false" ? true : false;
                item.IsFirstMinus = row["minusPlace"].ToString().ToLower() == "false" ? true : false;
                oReturnValue[i]   = item;
            }
            return(oReturnValue);
        }