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