public void LoadData(int notificationSubscriberId, bool showId) { Clear(); var data = new NotificationSubscriberDataModel(); data.NotificationSubscriberId = SystemKeyId; var items = Framework.Components.EventMonitoring.NotificationSubscriberDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count != 1) { return; } var item = items[0]; SetData(item); if (!showId) { SystemKeyId = item.NotificationSubscriberId; oHistoryList.Setup(PrimaryEntity, notificationSubscriberId, PrimaryEntityKey); } else { CoreSystemKey.Text = String.Empty; } }
public static int Create(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Create", requestProfile); var newId = DBDML.RunScalarSQL("NotificationSubscriber.Insert", sql, DataStoreKey); return(Convert.ToInt32(newId)); }
public override int?Save(string action) { var data = new NotificationSubscriberDataModel(); data.NotificationSubscriberId = SystemKeyId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; if (action == "Insert") { var dtNotificationSubscriber = Framework.Components.EventMonitoring.NotificationSubscriberDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtNotificationSubscriber.Rows.Count == 0) { Framework.Components.EventMonitoring.NotificationSubscriberDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { Framework.Components.EventMonitoring.NotificationSubscriberDataManager.Update(data, SessionVariables.RequestProfile); } return(data.NotificationSubscriberId); }
private static string CreateOrUpdate(NotificationSubscriberDataModel data, RequestProfile requestProfile, string action) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.NotificationSubscriberInsert " + "\r\n" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.NotificationSubscriberUpdate " + "\r\n" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, NotificationSubscriberDataModel.DataColumns.NotificationSubscriberId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder); return(sql); }
public static DataTable DoesExist(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var doesExistRequest = new NotificationSubscriberDataModel(); doesExistRequest.Name = data.Name; return(Search(doesExistRequest, requestProfile)); }
public static DataTable GetDetails(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile); var table = list.ToDataTable(); return(table); }
protected override void Clear() { base.Clear(); var data = new NotificationSubscriberDataModel(); SetData(data); }
private System.Data.DataTable GetData() { // TODO: on all export pages var data = new NotificationSubscriberDataModel(); var dt = Framework.Components.EventMonitoring.NotificationSubscriberDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
public static DataSet GetChildren(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.NotificationSubscriberChildrenGet" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, NotificationSubscriberDataModel.DataColumns.NotificationSubscriberId); var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey); return(oDT.DBDataset); }
private DataTable GetData(string name) { var data = new NotificationSubscriberDataModel(); data.Name = name; var dt = Framework.Components.EventMonitoring.NotificationSubscriberDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
public static DataSet DeleteChildren(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.NotificationSubscriberChildrenDelete " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, NotificationSubscriberDataModel.DataColumns.NotificationSubscriberId); var oDT = new DBDataSet("NotificationSubscriber.DeleteChildren", sql, DataStoreKey); return(oDT.DBDataset); }
private void UpdateData(ArrayList values) { var data = new NotificationSubscriberDataModel(); data.NotificationSubscriberId = 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.NotificationSubscriberDataManager.Update(data, SessionVariables.RequestProfile); ReBindEditableGrid(); }
public static bool DoesExist(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var doesExistRequest = new NotificationSubscriberDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; doesExistRequest.Name = data.Name; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
public static bool IsDeletable(NotificationSubscriberDataModel 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 void Delete(NotificationSubscriberDataModel dataQuery, RequestProfile requestProfile) { const string sql = @"dbo.NotificationSubscriberDelete "; var parameters = new { AuditId = requestProfile.AuditId , NotificationSubscriberId = dataQuery.NotificationSubscriberId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
public static bool IsDeletable(NotificationSubscriberDataModel 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 NotificationSubscriberDataModel(); data.NotificationSubscriberId = int.Parse(index); Framework.Components.EventMonitoring.NotificationSubscriberDataManager.Delete(data, SessionVariables.RequestProfile); DeleteAndRedirect(); } } catch (Exception ex) { Response.Write(ex.Message); } }
protected override void ShowData(int notificationSubscriberId) { base.ShowData(notificationSubscriberId); oDetailButtonPanel.SetId = SetId; Clear(); var data = new NotificationSubscriberDataModel(); data.NotificationSubscriberId = notificationSubscriberId; var items = Framework.Components.EventMonitoring.NotificationSubscriberDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count == 1) { var item = items[0]; SetData(item); oHistoryList.Setup(PrimaryEntity, notificationSubscriberId, "NotificationSubscriber"); } }
public static string ToSQLParameter(NotificationSubscriberDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case NotificationSubscriberDataModel.DataColumns.NotificationSubscriberId: if (data.NotificationSubscriberId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, NotificationSubscriberDataModel.DataColumns.NotificationSubscriberId, data.NotificationSubscriberId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, NotificationSubscriberDataModel.DataColumns.NotificationSubscriberId); } break; default: returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
public static List <NotificationSubscriberDataModel> GetEntityDetails(NotificationSubscriberDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.NotificationSubscriberSearch "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationId = requestProfile.ApplicationId , NotificationSubscriberId = dataQuery.NotificationSubscriberId , Name = dataQuery.Name , ReturnAuditInfo = returnAuditInfo , ApplicationMode = requestProfile.ApplicationModeId }; List <NotificationSubscriberDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <NotificationSubscriberDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
private void ReBindEditableGrid() { var data = new NotificationSubscriberDataModel(); var dtNotificationSubscriber = Framework.Components.EventMonitoring.NotificationSubscriberDataManager.Search(data, SessionVariables.RequestProfile); }
public void SetData(NotificationSubscriberDataModel data) { SystemKeyId = data.NotificationSubscriberId; base.SetData(data); }
public static void Update(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var sql = CreateOrUpdate(data, requestProfile, "Update"); DBDML.RunSQL("Clent.Update", sql, DataStoreKey); }
public static void Create(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var sql = CreateOrUpdate(data, requestProfile, "Create"); Framework.Components.DataAccess.DBDML.RunSQL("NotificationSubscriber.Insert", sql, DataStoreKey); }
public static NotificationSubscriberDataModel GetDetails(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 1); return(list.FirstOrDefault()); }
public static void Update(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Update", requestProfile); DBDML.RunSQL("NotificationSubscriber.Update", sql, DataStoreKey); }
public void SetData(NotificationSubscriberDataModel item) { SystemKeyId = item.NotificationSubscriberId; base.SetData(item); }
public static DataTable Search(NotificationSubscriberDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 0); return(list.ToDataTable()); }