Exemple #1
0
        public static int Create(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("NotificationPublisher.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
Exemple #2
0
        public void LoadData(int notificationPublisherId, bool showId)
        {
            Clear();

            var data = new NotificationPublisherDataModel();

            data.NotificationPublisherId = SystemKeyId;

            var items = Framework.Components.EventMonitoring.NotificationPublisherDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count != 1)
            {
                return;
            }

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.NotificationPublisherId;
                oHistoryList.Setup(PrimaryEntity, notificationPublisherId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
Exemple #3
0
        public static string Save(NotificationPublisherDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";

            switch (action)
            {
            case "Create":
                sql += "dbo.NotificationPublisherInsert  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                       ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId);
                break;

            case "Update":
                sql += "dbo.NotificationPublisherUpdate  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId);
                break;

            default:
                break;
            }
            sql = sql + ", " + ToSQLParameter(data, NotificationPublisherDataModel.DataColumns.NotificationPublisherId) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder);

            return(sql);
        }
Exemple #4
0
        //private static string DataStoreKey = "";

        //static NotificationPublisherDataManager()
        //{
        //    DataStoreKey = SetupConfiguration.GetDataStoreKey("NotificationPublisher");
        //}

        #region GetList

        //public static DataTable GetList(RequestProfile requestProfile)
        //{
        //    var sql = "EXEC dbo.NotificationPublisherSearch " +
        //        " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId)
        //        + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId);
        //    var oDT = new DBDataTable("NotificationPublisher.GetList", sql, DataStoreKey);

        //    return oDT.DBTable;
        //}

        public static List <NotificationPublisherDataModel> GetNotificationPublisherList(RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.NotificationPublisherSearch" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId);

            var result = new List <NotificationPublisherDataModel>();

            using (var reader = new DBDataReader("Get List", sql, DataStoreKey))
            {
                var dbReader = reader.DBReader;

                while (dbReader.Read())
                {
                    var dataItem = new NotificationPublisherDataModel();

                    dataItem.NotificationPublisherId = (int)dbReader[NotificationPublisherDataModel.DataColumns.NotificationPublisherId];
                    dataItem.ApplicationId           = (int)dbReader[BaseDataModel.BaseDataColumns.ApplicationId];

                    SetStandardInfo(dataItem, dbReader);

                    SetStandardInfo(dataItem, dbReader);

                    result.Add(dataItem);
                }
            }

            return(result);
        }
Exemple #5
0
        public static string ToSQLParameter(NotificationPublisherDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

            switch (dataColumnName)
            {
            case NotificationPublisherDataModel.DataColumns.NotificationPublisherId:
                if (data.NotificationPublisherId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, NotificationPublisherDataModel.DataColumns.NotificationPublisherId, data.NotificationPublisherId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, NotificationPublisherDataModel.DataColumns.NotificationPublisherId);
                }
                break;

            case NotificationPublisherDataModel.DataColumns.ApplicationId:
                if (data.ApplicationId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, NotificationPublisherDataModel.DataColumns.ApplicationId, data.ApplicationId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, NotificationPublisherDataModel.DataColumns.ApplicationId);
                }
                break;

            default:
                returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName);
                break;
            }

            return(returnValue);
        }
Exemple #6
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new NotificationPublisherDataModel();

            UpdatedData = Framework.Components.EventMonitoring.NotificationPublisherDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.NotificationPublisherId =
                    Convert.ToInt32(SelectedData.Rows[i][NotificationPublisherDataModel.DataColumns.NotificationPublisherId].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.NotificationPublisherDataManager.Update(data, SessionVariables.RequestProfile);
                data = new NotificationPublisherDataModel();
                data.NotificationPublisherId = Convert.ToInt32(SelectedData.Rows[i][NotificationPublisherDataModel.DataColumns.NotificationPublisherId].ToString());
                var dt = Framework.Components.EventMonitoring.NotificationPublisherDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
Exemple #7
0
        public override int?Save(string action)
        {
            var data = new NotificationPublisherDataModel();

            data.NotificationPublisherId = SystemKeyId;
            data.Name        = Name;
            data.Description = Description;
            data.SortOrder   = SortOrder;

            if (action == "Insert")
            {
                var dtNotificationPublisher = Framework.Components.EventMonitoring.NotificationPublisherDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtNotificationPublisher.Rows.Count == 0)
                {
                    Framework.Components.EventMonitoring.NotificationPublisherDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                Framework.Components.EventMonitoring.NotificationPublisherDataManager.Update(data, SessionVariables.RequestProfile);
            }

            return(data.NotificationPublisherId);
        }
Exemple #8
0
        public static List <NotificationPublisherDataModel> GetEntityDetails(NotificationPublisherDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.NotificationPublisherSearch ";

            var parameters =
                new
            {
                AuditId                   = requestProfile.AuditId
                , ApplicationId           = requestProfile.ApplicationId
                , NotificationPublisherId = dataQuery.NotificationPublisherId
                , Name            = dataQuery.Name
                , ApplicationMode = requestProfile.ApplicationModeId
                , ReturnAuditInfo = returnAuditInfo
            };

            List <NotificationPublisherDataModel> result;

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                result = dataAccess.Connection.Query <NotificationPublisherDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList();
            }


            return(result);
        }
Exemple #9
0
        public static DataTable GetDetails(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile);

            var table = list.ToDataTable();

            return(table);
        }
Exemple #10
0
        public static DataTable DoesExist(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new NotificationPublisherDataModel();

            doesExistRequest.Name = data.Name;

            return(Search(doesExistRequest, requestProfile));
        }
Exemple #11
0
        protected override void Clear()
        {
            base.Clear();

            var data = new NotificationPublisherDataModel();

            SetData(data);
        }
Exemple #12
0
        private System.Data.DataTable GetData()
        {
            // TODO: on all export pages
            var data = new NotificationPublisherDataModel();

            var dt = Framework.Components.EventMonitoring.NotificationPublisherDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Exemple #13
0
        private DataTable GetData(string name)
        {
            var data = new NotificationPublisherDataModel();

            data.Name = name;
            var dt = Framework.Components.EventMonitoring.NotificationPublisherDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Exemple #14
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var notificationPublisherdata = new NotificationPublisherDataModel();

            notificationPublisherdata.NotificationPublisherId = entityKey;
            var results = Framework.Components.EventMonitoring.NotificationPublisherDataManager.Search(notificationPublisherdata, SessionVariables.RequestProfile);

            return(results);
        }
Exemple #15
0
        public static DataSet GetChildren(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.NotificationPublisherChildrenGet" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, NotificationPublisherDataModel.DataColumns.NotificationPublisherId);
            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Exemple #16
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new NotificationPublisherDataModel();

            // copies properties from values dictionary object to data object
            PropertyMapper.CopyProperties(data, values);

            Framework.Components.EventMonitoring.NotificationPublisherDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Exemple #17
0
        public static DataSet DeleteChildren(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.NotificationPublisherChildrenDelete " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, NotificationPublisherDataModel.DataColumns.NotificationPublisherId);

            var oDT = new DBDataSet("NotificationPublisher.DeleteChildren", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Exemple #18
0
        private void UpdateData(ArrayList values)
        {
            var data = new NotificationPublisherDataModel();

            data.NotificationPublisherId = 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.NotificationPublisherDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
Exemple #19
0
        public static bool DoesExist(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new NotificationPublisherDataModel();

            doesExistRequest.ApplicationId = data.ApplicationId;
            doesExistRequest.Name          = data.Name;

            var list = GetEntityDetails(doesExistRequest, requestProfile, 0);

            return(list.Count > 0);
        }
Exemple #20
0
        public static DataTable EventTypeList(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            // formulate SQL
            var sql = "EXEC dbo.NotificationPublisherSearch " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, NotificationPublisherDataModel.DataColumns.ApplicationId);

            var oDT = new DataAccess.DBDataTable("EventType.Search", sql, DataStoreKey);

            return(oDT.DBTable);
        }
Exemple #21
0
        public static void Delete(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.NotificationPublisherDelete ";

            var parameters =
                new
            {
                AuditId = requestProfile.AuditId
                , NotificationPublisherId = data.NotificationPublisherId
            };

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
Exemple #22
0
        public static bool IsDeletable(NotificationPublisherDataModel 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);
        }
Exemple #23
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         string[] deleteIndexList = DeleteIds.Split(',');
         foreach (string index in deleteIndexList)
         {
             var data = new NotificationPublisherDataModel();
             data.NotificationPublisherId = int.Parse(index);
             Framework.Components.EventMonitoring.NotificationPublisherDataManager.Delete(data, SessionVariables.RequestProfile);
             DeleteAndRedirect();
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Exemple #24
0
        public static bool IsDeletable(NotificationPublisherDataModel 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);
        }
Exemple #25
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows = new DataTable();
                var notificationPublisherdata = new NotificationPublisherDataModel();

                selectedrows = Framework.Components.EventMonitoring.NotificationPublisherDataManager.GetDetails(notificationPublisherdata, SessionVariables.RequestProfile).Clone();
                if (!string.IsNullOrEmpty(SuperKey))
                {
                    var systemEntityTypeId = (int)PrimaryEntity;
                    var lstEntityKeys      = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey);

                    foreach (var entityKey in lstEntityKeys)
                    {
                        notificationPublisherdata.NotificationPublisherId = entityKey;
                        var result = Framework.Components.EventMonitoring.NotificationPublisherDataManager.GetDetails(notificationPublisherdata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    notificationPublisherdata.NotificationPublisherId = SetId;
                    var result = Framework.Components.EventMonitoring.NotificationPublisherDataManager.GetDetails(notificationPublisherdata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

            return(null);
        }
Exemple #26
0
        protected override void ShowData(int notificationPublisherId)
        {
            base.ShowData(notificationPublisherId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new NotificationPublisherDataModel();

            data.NotificationPublisherId = notificationPublisherId;

            var items = Framework.Components.EventMonitoring.NotificationPublisherDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count == 1)
            {
                var item = items[0];

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, notificationPublisherId, "NotificationPublisher");
            }
        }
Exemple #27
0
        public static DataTable Search(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }
Exemple #28
0
 private void ReBindEditableGrid()
 {
     var data = new NotificationPublisherDataModel();
     var dtNotificationPublisher = Framework.Components.EventMonitoring.NotificationPublisherDataManager.Search(data, SessionVariables.RequestProfile);
 }
Exemple #29
0
        public void SetData(NotificationPublisherDataModel data)
        {
            SystemKeyId = data.NotificationPublisherId;

            base.SetData(data);
        }
Exemple #30
0
        public static void Update(NotificationPublisherDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("NotificationPublisher.Update", sql, DataStoreKey);
        }