private static string CreateOrUpdate(NotificationEventTypeDataModel data, RequestProfile requestProfile, string action) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.NotificationEventTypeInsert " + "\r\n" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; case "Update": sql += "dbo.NotificationEventTypeUpdate " + "\r\n" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, NotificationEventTypeDataModel.DataColumns.NotificationEventTypeId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder) + ", " + ToSQLParameter(data, NotificationEventTypeDataModel.DataColumns.ApplicationId); return(sql); }
public static List <NotificationEventTypeDataModel> GetNotificationEventTypeList(RequestProfile requestProfile) { var sql = "EXEC dbo.NotificationEventTypeSearch" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); var result = new List <NotificationEventTypeDataModel>(); using (var reader = new DBDataReader("Get List", sql, DataStoreKey)) { var dbReader = reader.DBReader; while (dbReader.Read()) { var dataItem = new NotificationEventTypeDataModel(); dataItem.NotificationEventTypeId = (int)dbReader[NotificationEventTypeDataModel.DataColumns.NotificationEventTypeId]; dataItem.ApplicationId = (int)dbReader[BaseDataModel.BaseDataColumns.ApplicationId]; SetStandardInfo(dataItem, dbReader); SetStandardInfo(dataItem, dbReader); result.Add(dataItem); } } return(result); }
protected override DataTable UpdateData() { var UpdatedData = new DataTable(); var data = new NotificationEventTypeDataModel(); UpdatedData = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Search(data, SessionVariables.RequestProfile).Clone(); for (var i = 0; i < SelectedData.Rows.Count; i++) { data.NotificationEventTypeId = Convert.ToInt32(SelectedData.Rows[i][NotificationEventTypeDataModel.DataColumns.NotificationEventTypeId].ToString()); data.Name = SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Name].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.EventMonitoring.NotificationEventTypeDataManager.Update(data, SessionVariables.RequestProfile); data = new NotificationEventTypeDataModel(); data.NotificationEventTypeId = Convert.ToInt32(SelectedData.Rows[i][NotificationEventTypeDataModel.DataColumns.NotificationEventTypeId].ToString()); var dt = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Search(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 1) { UpdatedData.ImportRow(dt.Rows[0]); } } return(UpdatedData); }
public void LoadData(int notificationEventTypeId, bool showId) { Clear(); var data = new NotificationEventTypeDataModel(); data.NotificationEventTypeId = SystemKeyId; var items = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count != 1) { return; } var item = items[0]; SetData(item); if (!showId) { SystemKeyId = item.NotificationEventTypeId; oHistoryList.Setup(PrimaryEntity, notificationEventTypeId, PrimaryEntityKey); } else { CoreSystemKey.Text = String.Empty; } }
public static int Create(NotificationEventTypeDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Create", requestProfile); var newId = DBDML.RunScalarSQL("NotificationEventType.Insert", sql, DataStoreKey); return(Convert.ToInt32(newId)); }
public override int?Save(string action) { var data = new NotificationEventTypeDataModel(); data.NotificationEventTypeId = SystemKeyId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; if (action == "Insert") { var dtNotificationEventType = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtNotificationEventType.Rows.Count == 0) { Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Update(data, SessionVariables.RequestProfile); } return(data.NotificationEventTypeId); }
public static string ToSQLParameter(NotificationEventTypeDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case NotificationEventTypeDataModel.DataColumns.NotificationEventTypeId: if (data.NotificationEventTypeId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, NotificationEventTypeDataModel.DataColumns.NotificationEventTypeId, data.NotificationEventTypeId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, NotificationEventTypeDataModel.DataColumns.NotificationEventTypeId); } break; case NotificationEventTypeDataModel.DataColumns.ApplicationId: if (data.ApplicationId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, NotificationEventTypeDataModel.DataColumns.ApplicationId, data.ApplicationId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, NotificationEventTypeDataModel.DataColumns.ApplicationId); } break; default: returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
protected override void Clear() { base.Clear(); var data = new NotificationEventTypeDataModel(); SetData(data); }
public static DataTable DoesExist(NotificationEventTypeDataModel data, RequestProfile requestProfile) { var doesExistRequest = new NotificationEventTypeDataModel(); doesExistRequest.Name = data.Name; return(Search(doesExistRequest, requestProfile)); }
public static DataTable GetDetails(NotificationEventTypeDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile); var table = list.ToDataTable(); return(table); }
public static DataSet GetChildren(NotificationEventTypeDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.NotificationEventTypeChildrenGet" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, NotificationEventTypeDataModel.DataColumns.NotificationEventTypeId); var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey); return(oDT.DBDataset); }
protected override DataTable GetEntityData(int?entityKey) { var notificationEventTypedata = new NotificationEventTypeDataModel(); notificationEventTypedata.NotificationEventTypeId = entityKey; var results = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Search(notificationEventTypedata, SessionVariables.RequestProfile); return(results); }
private System.Data.DataTable GetData() { // TODO: on all export pages var data = new NotificationEventTypeDataModel(); var dt = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
private DataTable GetData(string name) { var data = new NotificationEventTypeDataModel(); data.Name = name; var dt = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
public static DataSet DeleteChildren(NotificationEventTypeDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.NotificationEventTypeChildrenDelete " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, NotificationEventTypeDataModel.DataColumns.NotificationEventTypeId); var oDT = new DBDataSet("NotificationEventType.DeleteChildren", sql, DataStoreKey); return(oDT.DBDataset); }
protected override void Update(Dictionary <string, string> values) { var data = new NotificationEventTypeDataModel(); // copies properties from values dictionary object to data object PropertyMapper.CopyProperties(data, values); Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Update(data, SessionVariables.RequestProfile); base.Update(values); }
public static DataTable EventTypeList(NotificationEventTypeDataModel data, RequestProfile requestProfile) { // formulate SQL var sql = "EXEC dbo.NotificationEventTypeSearch " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, NotificationEventTypeDataModel.DataColumns.ApplicationId); var oDT = new DataAccess.DBDataTable("EventType.Search", sql, DataStoreKey); return(oDT.DBTable); }
public static bool DoesExist(NotificationEventTypeDataModel data, RequestProfile requestProfile) { var doesExistRequest = new NotificationEventTypeDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; doesExistRequest.Name = data.Name; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
private void UpdateData(ArrayList values) { var data = new NotificationEventTypeDataModel(); data.NotificationEventTypeId = int.Parse(values[0].ToString()); data.Name = values[1].ToString(); data.Description = values[2].ToString(); data.SortOrder = int.Parse(values[3].ToString()); Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Update(data, SessionVariables.RequestProfile); ReBindEditableGrid(); }
public static void Delete(NotificationEventTypeDataModel dataQuery, RequestProfile requestProfile) { const string sql = @"dbo.NotificationEventTypeDelete "; var parameters = new { AuditId = requestProfile.AuditId , NotificationEventTypeId = dataQuery.NotificationEventTypeId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
public static bool IsDeletable(NotificationEventTypeDataModel 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 bool IsDeletable(NotificationEventTypeDataModel 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 void btnDelete_Click(object sender, EventArgs e) { try { string[] deleteIndexList = DeleteIds.Split(','); foreach (string index in deleteIndexList) { var data = new NotificationEventTypeDataModel(); data.NotificationEventTypeId = int.Parse(index); Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Delete(data, SessionVariables.RequestProfile); DeleteAndRedirect(); } } catch (Exception ex) { Response.Write(ex.Message); } }
protected override DataTable GetData() { try { SuperKey = ApplicationCommon.GetSuperKey(); SetId = ApplicationCommon.GetSetId(); var selectedrows = new DataTable(); var notificationEventTypedata = new NotificationEventTypeDataModel(); selectedrows = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.GetDetails(notificationEventTypedata, SessionVariables.RequestProfile).Clone(); if (!string.IsNullOrEmpty(SuperKey)) { var systemEntityTypeId = (int)PrimaryEntity; var lstEntityKeys = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey); foreach (var entityKey in lstEntityKeys) { notificationEventTypedata.NotificationEventTypeId = entityKey; var result = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.GetDetails(notificationEventTypedata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } } else { notificationEventTypedata.NotificationEventTypeId = SetId; var result = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.GetDetails(notificationEventTypedata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } return(selectedrows); } catch (Exception ex) { Response.Write(ex.Message); } return(null); }
protected override void ShowData(int notificationEventTypeId) { base.ShowData(notificationEventTypeId); oDetailButtonPanel.SetId = SetId; Clear(); var data = new NotificationEventTypeDataModel(); data.NotificationEventTypeId = notificationEventTypeId; var items = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count == 1) { var item = items[0]; SetData(item); oHistoryList.Setup(PrimaryEntity, notificationEventTypeId, "NotificationEventType"); } }
public static List <NotificationEventTypeDataModel> GetEntityDetails(NotificationEventTypeDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.NotificationEventTypeSearch "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationId = requestProfile.ApplicationId , NotificationEventTypeId = dataQuery.NotificationEventTypeId , Name = dataQuery.Name , ReturnAuditInfo = returnAuditInfo , ApplicationMode = requestProfile.ApplicationModeId }; List <NotificationEventTypeDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <NotificationEventTypeDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
public void SetData(NotificationEventTypeDataModel data) { SystemKeyId = data.NotificationEventTypeId; base.SetData(data); }
public static void Update(NotificationEventTypeDataModel data, RequestProfile requestProfile) { var sql = CreateOrUpdate(data, requestProfile, "Update"); DBDML.RunSQL("Clent.Update", sql, DataStoreKey); }
public void SetData(NotificationEventTypeDataModel item) { SystemKeyId = item.NotificationEventTypeId; base.SetData(item); }
private void ReBindEditableGrid() { var data = new NotificationEventTypeDataModel(); var dtNotificationEventType = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Search(data, SessionVariables.RequestProfile); }