private static SqlParameter[] CreateSqlParameter(CompanyEvent model) { return(new SqlParameter[] { new SqlParameter("@EventCode", model.EventCode), new SqlParameter("@EventType", model.EventType), new SqlParameter("@EventName", model.EventName), new SqlParameter("@EventDescription", model.EventDescription), new SqlParameter("@FromDate", model.FromDate), new SqlParameter("@ToDate", model.ToDate), new SqlParameter("@GroupCode", model.GroupCode), new SqlParameter("@Active", model.Active), new SqlParameter("@LocationId", model.LocationId), new SqlParameter("@LocationName", model.LocationName), new SqlParameter("@Currency", model.Currency), new SqlParameter("@EstimateAmount", model.EstimateAmount), new SqlParameter("@DonateAmount", model.DonateAmount), new SqlParameter("@Balance", model.Balance), new SqlParameter("@isClose", model.isClose), new SqlParameter("@CreatedUser", model.CreatedUser), new SqlParameter("@CreatedDate", model.CreatedDate), new SqlParameter("@UpdateDate", model.UpdateDate), new SqlParameter("@updateUser", model.updateUser), }); }
public static CompanyEvent UpdateItem(CompanyEvent model) { String result = String.Empty; using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "tblCompanyEvent_Update", CreateSqlParameter(model))) { while (reader.Read()) { result = (String)reader[0]; } } return(GetItemByID(result)); }
public static CompanyEventCollection GetAllByGroupCode(string GroupCode) { CompanyEventCollection collection = new CompanyEventCollection(); using (var reader = SqlHelper.ExecuteReader("tblCompanyEvent_GetAllbyGroupCode", new SqlParameter("@GroupCode", GroupCode))) { while (reader.Read()) { CompanyEvent obj = new CompanyEvent(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static CompanyEventCollection GetAllItem() { CompanyEventCollection collection = new CompanyEventCollection(); using (var reader = SqlHelper.ExecuteReader("tblCompanyEvent_GetAll", null)) { while (reader.Read()) { CompanyEvent obj = new CompanyEvent(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static CompanyEvent GetItemByID(String eventCode) { CompanyEvent item = new CompanyEvent(); var sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@EventCode", eventCode); using (var reader = SqlHelper.ExecuteReader("tblCompanyEvent_GetByID", sqlParams)) { while (reader.Read()) { item = GetItemFromReader(reader); } } return(item); }
private static CompanyEvent GetItemFromReader(IDataReader dataReader) { CompanyEvent objItem = new CompanyEvent(); objItem.EventCode = SqlHelper.GetString(dataReader, "EventCode"); objItem.EventType = SqlHelper.GetInt(dataReader, "EventType"); objItem.EventName = SqlHelper.GetString(dataReader, "EventName"); objItem.EventDescription = SqlHelper.GetString(dataReader, "EventDescription"); objItem.FromDate = SqlHelper.GetDateTime(dataReader, "FromDate"); objItem.ToDate = SqlHelper.GetDateTime(dataReader, "ToDate"); objItem.GroupCode = SqlHelper.GetString(dataReader, "GroupCode"); objItem.Active = SqlHelper.GetBoolean(dataReader, "Active"); objItem.LocationId = SqlHelper.GetInt(dataReader, "LocationId"); objItem.LocationName = SqlHelper.GetString(dataReader, "LocationName"); objItem.Currency = SqlHelper.GetString(dataReader, "Currency"); objItem.EstimateAmount = SqlHelper.GetDecimal(dataReader, "EstimateAmount"); objItem.DonateAmount = SqlHelper.GetDecimal(dataReader, "DonateAmount"); objItem.Balance = SqlHelper.GetDecimal(dataReader, "Balance"); objItem.isClose = SqlHelper.GetBoolean(dataReader, "isClose"); objItem.CreatedUser = SqlHelper.GetString(dataReader, "CreatedUser"); objItem.CreatedDate = SqlHelper.GetDateTime(dataReader, "CreatedDate"); objItem.UpdateDate = SqlHelper.GetDateTime(dataReader, "UpdateDate"); objItem.updateUser = SqlHelper.GetString(dataReader, "updateUser"); return(objItem); }
public static CompanyEvent AddItem(CompanyEvent model) { String result = String.Empty; try { using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "tblCompanyEvent_Add", CreateSqlParameter(model))) { while (reader.Read()) { result = (String)reader[0]; } } } catch (Exception objEx) { result = objEx.Message; } return(GetItemByID(result)); }