public static T_COM_Master_Entity UpdateItem(T_COM_Master_Entity model) { int result = 0; using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, CommandType.StoredProcedure, "T_COM_Master_Entity_Update", CreateSqlParameter(model))) { while (reader.Read()) { result = (int)reader[0]; } } return(GetItemByID(result)); }
public static T_COM_Master_EntityCollection Search(SearchFilter SearchKey) { T_COM_Master_EntityCollection collection = new T_COM_Master_EntityCollection(); using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Entity_Search", SearchFilterManager.SqlSearchParamNoCompany(SearchKey))) { while (reader.Read()) { T_COM_Master_Entity obj = new T_COM_Master_Entity(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static T_COM_Master_EntityCollection GetAllItem() { T_COM_Master_EntityCollection collection = new T_COM_Master_EntityCollection(); using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Entity_GetAll", null)) { while (reader.Read()) { T_COM_Master_Entity obj = new T_COM_Master_Entity(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static T_COM_Master_Entity GetItemByID(int EntityId) { T_COM_Master_Entity item = new T_COM_Master_Entity(); var sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@EntityId", EntityId); using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Entity_GetByID", sqlParams)) { while (reader.Read()) { item = GetItemFromReader(reader); } } return(item); }
private static SqlParameter[] CreateSqlParameter(T_COM_Master_Entity model) { return(new SqlParameter[] { new SqlParameter("@EntityId", model.EntityId), new SqlParameter("@ShortName_EN", model.ShortName_EN), new SqlParameter("@ShortName_VT", model.ShortName_VT), new SqlParameter("@LongName_EN", model.LongName_EN), new SqlParameter("@LongName_VT", model.LongName_VT), new SqlParameter("@Description", model.Description), new SqlParameter("@Address_EN", model.Address_EN), new SqlParameter("@Address_VT", model.Address_VT), new SqlParameter("@PerDayWorkingHour", model.PerDayWorkingHour), new SqlParameter("@CreatedBy", model.CreatedBy), new SqlParameter("@CreatedDate", model.CreatedDate), new SqlParameter("@ModifiedBy", model.ModifiedBy), new SqlParameter("@ModifiedDate", model.ModifiedDate), new SqlParameter("@IsAcitve", model.IsAcitve), }); }
private static T_COM_Master_Entity GetItemFromReader(IDataReader dataReader) { T_COM_Master_Entity objItem = new T_COM_Master_Entity(); objItem.EntityId = SqlHelper.GetInt(dataReader, "EntityId"); objItem.ShortName_EN = SqlHelper.GetString(dataReader, "ShortName_EN"); objItem.ShortName_VT = SqlHelper.GetString(dataReader, "ShortName_VT"); objItem.LongName_EN = SqlHelper.GetString(dataReader, "LongName_EN"); objItem.LongName_VT = SqlHelper.GetString(dataReader, "LongName_VT"); objItem.Description = SqlHelper.GetString(dataReader, "Description"); objItem.Address_EN = SqlHelper.GetString(dataReader, "Address_EN"); objItem.Address_VT = SqlHelper.GetString(dataReader, "Address_VT"); objItem.PerDayWorkingHour = SqlHelper.GetDecimal(dataReader, "PerDayWorkingHour"); 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.IsAcitve = SqlHelper.GetBoolean(dataReader, "IsAcitve"); if (SqlHelper.ColumnExists(dataReader, "TotalRecord")) { objItem.TotalRecord = SqlHelper.GetInt(dataReader, "TotalRecord"); } return(objItem); }