Пример #1
0
        private SqlParameter[] CalcFlagToParam(CalcFlag flag, string currentUser, bool isInsertOp)
        {
            List<SqlParameter> paras = new List<SqlParameter>();
            paras.Add(new SqlParameter("@CalcFlagId", SqlDbType.VarChar, 20));
            paras.Add(new SqlParameter("@CalcFlagName", SqlDbType.NVarChar, 100));
            paras.Add(new SqlParameter("@SysFixed", SqlDbType.Bit));
            paras.Add(new SqlParameter("@UpdateUser", SqlDbType.VarChar, 20));

            paras[0].Value = flag.FlagId;
            paras[1].Value = flag.FlagName;
            paras[2].Value = flag.SystemFixed;
            paras[3].Value = currentUser;

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

            return paras.ToArray();
        }
Пример #2
0
        public List<CalcFlag> searchCalcFlagAll()
        {
            string sqlStr = dbUtil.getSqlStatement("SQL_Payroll_CalcFlag_SearchAll");

            try
            {
                List<CalcFlag> flagList = new List<CalcFlag>();
                DataSet searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, null);
                foreach (DataTable dt in searchResult.Tables)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        CalcFlag flag = new CalcFlag();
                        flag.FlagId = dr["FlagID"].ToString();
                        flag.FlagName = dr["FlagName"].ToString();
                        flag.SystemFixed = Convert.ToBoolean(dr["SysFixed"]);
                        flagList.Add(flag);
                    }
                }

                return flagList;
            }
            catch (Exception ex)
            {
                throw new DAOException("E0001", ex);
            }
        }
Пример #3
0
        public int updateCalcFlag(SqlTransaction trans, CalcFlag falg, string currentUser)
        {
            string sqlStr = dbUtil.getSqlStatement("SQL_PayrollItem_UpdateCalcFlag");
            SqlParameter[] sqlParams = CalcFlagToParam(falg, currentUser, false);

            try
            {
                return DAO.DBAccess.ExecuteNonQuery(trans, CommandType.Text, sqlStr, sqlParams);
            }
            catch (Exception ex)
            {
                throw new DAOException("E0001", ex);
            }
        }
Пример #4
0
 private void ReadPageData()
 {
     calcFlags.Clear();
     foreach (DataGridViewRow row in dgvCalcFalg.Rows)
     {
         CalcFlag flag = new CalcFlag();
         string id = row.Cells[0].Value.ToString();
         if (id.Equals(newID))
         {
             id = "";
         }
         flag.FlagId = id;
         flag.FlagName = row.Cells[1].Value.ToString();
         flag.SystemFixed = Convert.ToBoolean(row.Cells[2].Value);
         calcFlags.Add(flag);
     }
 }