Esempio n. 1
0
        private static ComEmp GetItemFromReader(IDataReader dataReader)
        {
            ComEmp objItem = new ComEmp();

            objItem.EmpCode = SqlHelper.GetString(dataReader, "EmpCode");

            objItem.EmpName = SqlHelper.GetString(dataReader, "EmpName");

            objItem.GroupCode = SqlHelper.GetString(dataReader, "GroupCode");

            objItem.DepartmentCode = SqlHelper.GetString(dataReader, "DepartmentCode");

            objItem.Email = SqlHelper.GetString(dataReader, "Email");

            objItem.Position = SqlHelper.GetString(dataReader, "Position");

            objItem.SalaryContractAmt = SqlHelper.GetDecimal(dataReader, "SalaryContractAmt");

            objItem.ContractDate = SqlHelper.GetDateTime(dataReader, "ContractDate");

            objItem.IsPermanent = SqlHelper.GetBoolean(dataReader, "IsPermanent");

            objItem.CuryCode = SqlHelper.GetString(dataReader, "CuryCode");

            objItem.CreatedDate = SqlHelper.GetDateTime(dataReader, "CreatedDate");

            objItem.CreatedUser = SqlHelper.GetString(dataReader, "CreatedUser");

            objItem.UpdatedDate = SqlHelper.GetDateTime(dataReader, "UpdatedDate");

            objItem.UpdatedUser = SqlHelper.GetString(dataReader, "UpdatedUser");
            return(objItem);
        }
Esempio n. 2
0
        public static ComEmp UpdateItem(ComEmp model)
        {
            String result = String.Empty;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "tblComEmp_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (String)reader[0];
                }
            }
            return(GetItemByID(result));
        }
Esempio n. 3
0
        public static ComEmpCollection GetAllItemByGroupCode(string GroupCode)
        {
            ComEmpCollection collection = new ComEmpCollection();

            using (var reader = SqlHelper.ExecuteReader("tblComEmp_GetByGroupCode", new SqlParameter("@GroupCode", GroupCode)))
            {
                while (reader.Read())
                {
                    ComEmp obj = new ComEmp();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Esempio n. 4
0
        public static ComEmpCollection GetAllItem()
        {
            ComEmpCollection collection = new ComEmpCollection();

            using (var reader = SqlHelper.ExecuteReader("tblComEmp_GetAll", null))
            {
                while (reader.Read())
                {
                    ComEmp obj = new ComEmp();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Esempio n. 5
0
        public static ComEmp GetItemByID(String empCode)
        {
            ComEmp item      = new ComEmp();
            var    sqlParams = new SqlParameter[1];

            sqlParams[0] = new SqlParameter("@EmpCode", empCode);
            using (var reader = SqlHelper.ExecuteReader("tblComEmp_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
Esempio n. 6
0
 private static SqlParameter[] CreateSqlParameter(ComEmp model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@EmpCode", model.EmpCode),
         new SqlParameter("@EmpName", model.EmpName),
         new SqlParameter("@GroupCode", model.GroupCode),
         new SqlParameter("@DepartmentCode", model.DepartmentCode),
         new SqlParameter("@Email", model.Email),
         new SqlParameter("@Position", model.Position),
         new SqlParameter("@SalaryContractAmt", model.SalaryContractAmt),
         new SqlParameter("@ContractDate", model.ContractDate),
         new SqlParameter("@IsPermanent", model.IsPermanent),
         new SqlParameter("@CuryCode", model.CuryCode),
         new SqlParameter("@CreatedDate", model.CreatedDate),
         new SqlParameter("@CreatedUser", model.CreatedUser),
         new SqlParameter("@UpdatedDate", model.UpdatedDate),
         new SqlParameter("@UpdatedUser", model.UpdatedUser),
     });
 }