public static int Create(ReportCategoryDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Create", requestProfile); var newId = DBDML.RunScalarSQL("ReportCategory.Insert", sql, DataStoreKey); return(Convert.ToInt32(newId)); }
public void LoadData(int ReportCategoryId, bool showId) { Clear(); var data = new ReportCategoryDataModel(); data.ReportCategoryId = ReportCategoryId; var items = Framework.Components.Core.ReportCategoryDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count != 1) { return; } var item = items[0]; CreatedByAuditId = item.CreatedByAuditId; ModifiedByAuditId = item.ModifiedByAuditId; CreatedDate = item.CreatedDate; ModifiedDate = item.ModifiedDate; SetData(item); if (!showId) { SystemKeyId = item.ReportCategoryId; ApplicationId = item.ApplicationId; oHistoryList.Setup(PrimaryEntity, ReportCategoryId, PrimaryEntityKey); } else { CoreSystemKey.Text = String.Empty; } }
protected override DataTable UpdateData() { var UpdatedData = new DataTable(); var data = new ReportCategoryDataModel(); UpdatedData = Framework.Components.Core.ReportCategoryDataManager.Search(data, SessionVariables.RequestProfile).Clone(); for (var i = 0; i < SelectedData.Rows.Count; i++) { data.ReportCategoryId = Convert.ToInt32(SelectedData.Rows[i][ReportCategoryDataModel.DataColumns.ReportCategoryId].ToString()); data.Name = SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Name].ToString(); data.ApplicationId = Convert.ToInt32(SelectedData.Rows[i][BaseDataModel.BaseDataColumns.ApplicationId].ToString()); data.Description = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description)) ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description) : SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Description].ToString(); data.SortOrder = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder)) ? int.Parse(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder).ToString()) : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString()); Framework.Components.Core.ReportCategoryDataManager.Update(data, SessionVariables.RequestProfile); data = new ReportCategoryDataModel(); data.ReportCategoryId = Convert.ToInt32(SelectedData.Rows[i][ReportCategoryDataModel.DataColumns.ReportCategoryId].ToString()); var dt = Framework.Components.Core.ReportCategoryDataManager.Search(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 1) { UpdatedData.ImportRow(dt.Rows[0]); } } return(UpdatedData); }
protected override void ShowData(int reportCategoryId) { base.ShowData(reportCategoryId); oDetailButtonPanel.SetId = SetId; Clear(); var data = new ReportCategoryDataModel(); data.ReportCategoryId = reportCategoryId; var items = Framework.Components.Core.ReportCategoryDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count == 1) { var item = items[0]; lblCreatedByAuditId.Text = item.CreatedByAuditId.ToString(); lblModifiedByAuditId.Text = item.ModifiedByAuditId.ToString(); lblCreatedDate.Text = item.CreatedDate.Value.ToString(SessionVariables.UserDateFormat); lblModifiedDate.Text = item.ModifiedDate.Value.ToString(SessionVariables.UserDateFormat); lblApplication.Text = item.Application; SetData(item); oHistoryList.Setup(PrimaryEntity, reportCategoryId, "ReportCategory"); } }
public static List <ReportCategoryDataModel> GetEntityDetails(ReportCategoryDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.ReportCategorySearch "; var parameters = new { AuditId = requestProfile.AuditId , ReportCategoryId = dataQuery.ReportCategoryId , Name = dataQuery.Name , ReturnAuditInfo = returnAuditInfo , Description = dataQuery.Description , CreatedDate = dataQuery.CreatedDate , ModifiedDate = dataQuery.ModifiedDate , CreatedByAuditId = dataQuery.CreatedByAuditId , ModifiedByAuditId = dataQuery.ModifiedByAuditId , ApplicationId = dataQuery.ApplicationId }; List <ReportCategoryDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <ReportCategoryDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
public override int?Save(string action) { var data = new ReportCategoryDataModel(); data.ReportCategoryId = SystemKeyId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; data.ApplicationId = ApplicationId; if (action == "Insert") { var dtReportCategory = Framework.Components.Core.ReportCategoryDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtReportCategory.Rows.Count == 0) { Framework.Components.Core.ReportCategoryDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { data.CreatedDate = CreatedDate; Framework.Components.Core.ReportCategoryDataManager.Update(data, SessionVariables.RequestProfile); } return(data.ReportCategoryId); }
public static string Save(ReportCategoryDataModel data, string action, RequestProfile requestProfile) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.ReportCategoryInsert " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.ReportCategoryUpdate " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, ReportCategoryDataModel.DataColumns.ReportCategoryId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder); return(sql); }
public static DataTable DoesExist(ReportCategoryDataModel data, RequestProfile requestProfile) { var doesExistRequest = new ReportCategoryDataModel(); doesExistRequest.Name = data.Name; return(Search(doesExistRequest, requestProfile)); }
protected override void Clear() { base.Clear(); var data = new ReportCategoryDataModel(); SetData(data); }
public static DataTable GetDetails(ReportCategoryDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile); var table = list.ToDataTable(); return(table); }
private DataTable GetData(string name) { var data = new ReportCategoryDataModel(); data.Name = name; var dt = Framework.Components.Core.ReportCategoryDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
private System.Data.DataTable GetData() { // TODO: on all export pages var data = new ReportCategoryDataModel(); var dt = Framework.Components.Core.ReportCategoryDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
public static DataSet GetChildren(ReportCategoryDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.ReportCategoryChildrenGet" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, ReportCategoryDataModel.DataColumns.ReportCategoryId); var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey); return(oDT.DBDataset); }
protected override DataTable GetEntityData(int?entityKey) { var reportCategorydata = new ReportCategoryDataModel(); reportCategorydata.ReportCategoryId = entityKey; var results = Framework.Components.Core.ReportCategoryDataManager.Search(reportCategorydata, SessionVariables.RequestProfile); return(results); }
public static bool DoesExist(ReportCategoryDataModel data, RequestProfile requestProfile) { var doesExistRequest = new ReportCategoryDataModel(); doesExistRequest.Name = data.Name; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
static public DataSet DeleteChildren(ReportCategoryDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.ReportCategoryChildrenDelete " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, ReportCategoryDataModel.DataColumns.ReportCategoryId); var oDT = new DBDataSet("ReportCategory.DeleteChildren", sql, DataStoreKey); return(oDT.DBDataset); }
protected override void Update(Dictionary <string, string> values) { var data = new ReportCategoryDataModel(); // copies properties from values dictionary object to data object PropertyMapper.CopyProperties(data, values); Framework.Components.Core.ReportCategoryDataManager.Update(data, SessionVariables.RequestProfile); base.Update(values); }
private void UpdateData(ArrayList values) { var data = new ReportCategoryDataModel(); data.ReportCategoryId = int.Parse(values[0].ToString()); data.Name = values[1].ToString(); data.Description = values[2].ToString(); data.SortOrder = int.Parse(values[3].ToString()); Framework.Components.Core.ReportCategoryDataManager.Update(data, SessionVariables.RequestProfile); ReBindEditableGrid(); }
protected override void Clear() { base.Clear(); var data = new ReportCategoryDataModel(); CreatedDate = data.CreatedDate; ModifiedDate = data.ModifiedDate; CreatedByAuditId = data.CreatedByAuditId; ModifiedByAuditId = data.ModifiedByAuditId; ApplicationId = data.ApplicationId; SetData(data); }
public static void Delete(ReportCategoryDataModel data, RequestProfile requestProfile) { const string sql = @"dbo.ReportCategoryDelete "; var parameters = new { AuditId = requestProfile.AuditId , ReportCategoryId = data.ReportCategoryId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
public static bool IsDeletable(ReportCategoryDataModel data, RequestProfile requestProfile) { var isDeletable = true; var ds = GetChildren(data, requestProfile); if (ds != null && ds.Tables.Count > 0) { if (ds.Tables.Cast <DataTable>().Any(dt => dt.Rows.Count > 0)) { isDeletable = false; } } return(isDeletable); }
public static string ToSQLParameter(ReportCategoryDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case ReportCategoryDataModel.DataColumns.ReportCategoryId: if (data.ReportCategoryId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, ReportCategoryDataModel.DataColumns.ReportCategoryId, data.ReportCategoryId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ReportCategoryDataModel.DataColumns.ReportCategoryId); } break; case ReportCategoryDataModel.DataColumns.ApplicationId: if (data.ApplicationId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, ReportCategoryDataModel.DataColumns.ApplicationId, data.ApplicationId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ReportCategoryDataModel.DataColumns.ApplicationId); } break; case ReportCategoryDataModel.DataColumns.Application: if (!string.IsNullOrEmpty(data.Application)) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, ReportCategoryDataModel.DataColumns.Application, data.Application.Trim()); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ReportCategoryDataModel.DataColumns.Application); } break; default: returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
protected void btnDelete_Click(object sender, EventArgs e) { try { string[] deleteIndexList = DeleteIds.Split(','); foreach (string index in deleteIndexList) { var data = new ReportCategoryDataModel(); data.ReportCategoryId = int.Parse(index); Framework.Components.Core.ReportCategoryDataManager.Delete(data, SessionVariables.RequestProfile); DeleteAndRedirect(); } } catch (Exception ex) { Response.Write(ex.Message); } }
public static bool IsDeletable(ReportCategoryDataModel data, RequestProfile requestProfile) { var isDeletable = true; var ds = GetChildren(data, requestProfile); if (ds != null && ds.Tables.Count > 0) { foreach (DataTable dt in ds.Tables) { if (dt.Rows.Count > 0) { isDeletable = false; break; } } } return(isDeletable); }
protected override DataTable GetData() { try { SuperKey = ApplicationCommon.GetSuperKey(); SetId = ApplicationCommon.GetSetId(); var selectedrows = new DataTable(); var reportCategorydata = new ReportCategoryDataModel(); selectedrows = Framework.Components.Core.ReportCategoryDataManager.GetDetails(reportCategorydata, SessionVariables.RequestProfile).Clone(); if (!string.IsNullOrEmpty(SuperKey)) { var systemEntityTypeId = (int)PrimaryEntity; var lstEntityKeys = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey); foreach (var entityKey in lstEntityKeys) { reportCategorydata.ReportCategoryId = entityKey; var result = Framework.Components.Core.ReportCategoryDataManager.GetDetails(reportCategorydata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } } else { reportCategorydata.ReportCategoryId = SetId; var result = Framework.Components.Core.ReportCategoryDataManager.GetDetails(reportCategorydata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } return(selectedrows); } catch (Exception ex) { Response.Write(ex.Message); } return(null); }
public static string ToSQLParameter(ReportCategoryDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case ReportCategoryDataModel.DataColumns.ReportCategoryId: if (data.ReportCategoryId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, ReportCategoryDataModel.DataColumns.ReportCategoryId, data.ReportCategoryId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ReportCategoryDataModel.DataColumns.ReportCategoryId); } break; default: returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
public static DataTable Search(ReportCategoryDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 0); return(list.ToDataTable()); }
public void SetData(ReportCategoryDataModel data) { SystemKeyId = data.ReportCategoryId; base.SetData(data); }
public static void Update(ReportCategoryDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Update", requestProfile); DBDML.RunSQL("ReportCategory.Update", sql, DataStoreKey); }
public static ReportCategoryDataModel GetDetails(ReportCategoryDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 1); return(list.FirstOrDefault()); }