Beispiel #1
0
 private void UpdateMonthFixed(FixedAmountItem[] items)
 {
     UpdateFixItem(items, dgvMonthFix);
 }
Beispiel #2
0
        private void SaveFixAmount(string empId, FixedAmountItem[] monFixitems, FixedAmountItem[] bonusFixitems, SqlTransaction trans)
        {
            try
            {
                // delete all.
                empDAO.deleteFixAmountByEmpId(trans, empId);

                // insert new.
                foreach (FixedAmountItem item in monFixitems)
                {
                    item.EmployeeId = empId;
                    empDAO.addFixAmountItem(trans, item, "N0001");
                }
                foreach (FixedAmountItem item in bonusFixitems)
                {
                    item.EmployeeId = empId;
                    empDAO.addFixAmountItem(trans, item, "N0001");
                }
            }
            catch (DAOException)
            {
                throw;
            }
        }
Beispiel #3
0
        private void UpdateFixItem(FixedAmountItem[] items, DataGridView dgv)
        {
            dgv.Rows.Clear();

            foreach (FixedAmountItem item in items)
            {
                dgv.Rows.Add(new object[3] { item.ItemName, item.ItemValue, item.PayrollItemId});
            }
        }
Beispiel #4
0
 private void UpdateBonusFixed(FixedAmountItem[] items)
 {
     UpdateFixItem(items, dgvBonusFix);
 }
Beispiel #5
0
        private SqlParameter[] BuildFixAmountParam(FixedAmountItem item, string currentUser, bool isInsertOP)
        {
            List<SqlParameter> paras = new List<SqlParameter>();
            paras.Add(new SqlParameter("@EmployeeId", SqlDbType.VarChar, 20));
            paras.Add(new SqlParameter("@PayrollItemId",SqlDbType.VarChar,20));
            paras.Add(new SqlParameter("@ItemValue",SqlDbType.Float));
            paras.Add(new SqlParameter("@UpdateUser", SqlDbType.VarChar, 20));

            paras[0].Value = item.EmployeeId;
            paras[1].Value = item.PayrollItemId;
            paras[2].Value = item.ItemValue;
            paras[3].Value = currentUser;

            if (isInsertOP)
            {
                paras.Add(new SqlParameter("@CreateUser", SqlDbType.VarChar, 20));
                paras[4].Value = currentUser;
            }

            return paras.ToArray();
        }
Beispiel #6
0
        public List<FixedAmountItem> getEmpFixedAmountItem(string id, bool bonus)
        {
            string sqlStr = bonus ?
                dbUtil.getSqlStatement("SQL_EMP_BonusFix_SearchByEmpId") :
                dbUtil.getSqlStatement("SQL_EMP_MonthFix_SearchByEmpId");

            SqlParameter[] sqlParms = {
                new SqlParameter("@EmpID",SqlDbType.VarChar,20)
            };
            sqlParms[0].Value = id;

            try
            {
                List<FixedAmountItem> mfs = new List<FixedAmountItem>();
                DataSet searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms);
                foreach (DataTable dt in searchResult.Tables)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        FixedAmountItem mf = new FixedAmountItem();
                        mf.EmployeeId = id;
                        mf.PayrollItemId = dr["PayrollItemId"].ToString();
                        mf.ItemName = dr["ItemName"].ToString();
                        mf.ItemValue = Convert.ToDouble(dr["ItemValue"]);
                        mfs.Add(mf);
                    }
                }

                return mfs;
            }
            catch (Exception ex)
            {
                throw new DAOException("E0001", ex);
            }
        }
Beispiel #7
0
        public int addFixAmountItem(SqlTransaction trans, FixedAmountItem item, string currentUser)
        {
            string sqlStr = dbUtil.getSqlStatement("SQL_EMP_FixAmount_Insert");
            SqlParameter[] sqlParms = BuildFixAmountParam(item, currentUser, true);

            try
            {
                return (int)DAO.DBAccess.ExecuteNonQuery(trans, CommandType.Text, sqlStr, sqlParms);
            }
            catch (Exception ex)
            {
                throw new DAOException("E0001", ex);
            }
        }