public void Delete(string value) { var dataDelete = new BrokerTypeDataModel(); dataDelete.BrokerTypeId = int.Parse(value); BrokerTypeDataManager.Delete(dataDelete, SessionVariables.RequestProfile); }
public static int Create(BrokerTypeDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Create", requestProfile); var newId = DBDML.RunScalarSQL("BrokerType.Insert", sql, DataStoreKey); return(Convert.ToInt32(newId)); }
public static string Save(BrokerTypeDataModel data, string action, RequestProfile requestProfile) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.BrokerTypeInsert " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.BrokerTypeUpdate " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, BrokerTypeDataModel.DataColumns.BrokerTypeId); sql = sql + ", " + ToSQLParameter(data, BrokerTypeDataModel.DataColumns.Name); sql = sql + ", " + ToSQLParameter(data, BrokerTypeDataModel.DataColumns.Description); sql = sql + ", " + ToSQLParameter(data, BrokerTypeDataModel.DataColumns.SortOrder); return(sql); }
public static string ToSQLParameter(BrokerTypeDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case BrokerTypeDataModel.DataColumns.BrokerTypeId: if (data.BrokerTypeId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, BrokerTypeDataModel.DataColumns.BrokerTypeId, data.BrokerTypeId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, BrokerTypeDataModel.DataColumns.BrokerTypeId); } break; case BrokerTypeDataModel.DataColumns.Name: if (!string.IsNullOrEmpty(data.Name)) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, BrokerTypeDataModel.DataColumns.Name, data.Name); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, BrokerTypeDataModel.DataColumns.Name); } break; case BrokerTypeDataModel.DataColumns.Description: if (!string.IsNullOrEmpty(data.Description)) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, BrokerTypeDataModel.DataColumns.Description, data.Description); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, BrokerTypeDataModel.DataColumns.Description); } break; case BrokerTypeDataModel.DataColumns.SortOrder: if (data.SortOrder != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, BrokerTypeDataModel.DataColumns.SortOrder, data.SortOrder); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, BrokerTypeDataModel.DataColumns.SortOrder); } break; default: returnValue = BaseDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
public BrokerTypeDataModel GetById(string value) { var dataQuery = new BrokerTypeDataModel(); dataQuery.BrokerTypeId = int.Parse(value); var result = BrokerTypeDataManager.GetEntityDetails(dataQuery, SessionVariables.RequestProfile, 1); return(result[0]); }
public static bool DoesExist(BrokerTypeDataModel data, RequestProfile requestProfile) { var doesExistRequest = new BrokerTypeDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; doesExistRequest.Name = data.Name; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
public static void Delete(BrokerTypeDataModel data, RequestProfile requestProfile) { const string sql = @"dbo.BrokerTypeDelete "; var parameters = new { AuditId = requestProfile.AuditId , BrokerTypeId = data.BrokerTypeId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
public static List <BrokerTypeDataModel> GetEntityDetails(BrokerTypeDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.BrokerTypeSearch "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationId = requestProfile.ApplicationId , ReturnAuditInfo = returnAuditInfo , BrokerTypeId = dataQuery.BrokerTypeId , Name = dataQuery.Name }; List <BrokerTypeDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <BrokerTypeDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
public static void Update(BrokerTypeDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Update", requestProfile); DBDML.RunSQL("BrokerType.Update", sql, DataStoreKey); }
public static DataTable Search(BrokerTypeDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 0); return(list.ToDataTable()); }