private static T_CMS_Static_ContractTerm GetItemFromReader(IDataReader dataReader)
        {
            T_CMS_Static_ContractTerm objItem = new T_CMS_Static_ContractTerm();

            objItem.ID = SqlHelper.GetInt(dataReader, "ID");

            objItem.EmpSubTypeID = SqlHelper.GetInt(dataReader, "EmpSubTypeID");

            objItem.ContractTermMonths = SqlHelper.GetInt(dataReader, "ContractTermMonths");

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

            objItem.CreatedBy = SqlHelper.GetInt(dataReader, "CreatedBy");

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

            objItem.ModifiedBy = SqlHelper.GetInt(dataReader, "ModifiedBy");

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

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



            if (SqlHelper.ColumnExists(dataReader, "TotalRecord"))
            {
                objItem.TotalRecord = SqlHelper.GetInt(dataReader, "TotalRecord");
            }
            return(objItem);
        }
        public static T_CMS_Static_ContractTerm UpdateItem(T_CMS_Static_ContractTerm model)
        {
            int result = 0;

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, CommandType.StoredProcedure, "T_CMS_Static_ContractTerm_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (int)reader[0];
                }
            }
            return(GetItemByID(result));
        }
        public static T_CMS_Static_ContractTerm GetItemByID(int ID)
        {
            T_CMS_Static_ContractTerm item = new T_CMS_Static_ContractTerm();
            var sqlParams = new SqlParameter[1];

            sqlParams[0] = new SqlParameter("@ID", ID);
            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_CMS_Static_ContractTerm_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
 private static SqlParameter[] CreateSqlParameter(T_CMS_Static_ContractTerm model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@ID", model.ID),
         new SqlParameter("@EmpSubTypeID", model.EmpSubTypeID),
         new SqlParameter("@ContractTermMonths", model.ContractTermMonths),
         new SqlParameter("@IsActive", model.IsActive),
         new SqlParameter("@CreatedBy", model.CreatedBy),
         new SqlParameter("@CreatedDate", model.CreatedDate),
         new SqlParameter("@ModifiedBy", model.ModifiedBy),
         new SqlParameter("@ModifiedDate", model.ModifiedDate),
         new SqlParameter("@PeriodDescription", model.PeriodDescription),
     });
 }
        public static T_CMS_Static_ContractTermCollection Search(SearchFilter SearchKey)
        {
            T_CMS_Static_ContractTermCollection collection = new T_CMS_Static_ContractTermCollection();

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_CMS_Static_ContractTerm_Search", SearchFilterManager.SqlSearchConditionNoCompany(SearchKey)))
            {
                while (reader.Read())
                {
                    T_CMS_Static_ContractTerm obj = new T_CMS_Static_ContractTerm();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
        public static T_CMS_Static_ContractTermCollection GetAllItem()
        {
            T_CMS_Static_ContractTermCollection collection = new T_CMS_Static_ContractTermCollection();

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_CMS_Static_ContractTerm_GetAll", null))
            {
                while (reader.Read())
                {
                    T_CMS_Static_ContractTerm obj = new T_CMS_Static_ContractTerm();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }