Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        protected override void Clear()
        {
            base.Clear();

            var data = new NotificationEventTypeDataModel();

            SetData(data);
        }
Exemplo n.º 9
0
        public static DataTable DoesExist(NotificationEventTypeDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new NotificationEventTypeDataModel();

            doesExistRequest.Name = data.Name;

            return(Search(doesExistRequest, requestProfile));
        }
Exemplo n.º 10
0
        public static DataTable GetDetails(NotificationEventTypeDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile);

            var table = list.ToDataTable();

            return(table);
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        private DataTable GetData(string name)
        {
            var data = new NotificationEventTypeDataModel();

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

            return(dt);
        }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
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();
        }
Exemplo n.º 20
0
        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);
            }
        }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
 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);
     }
 }
Exemplo n.º 24
0
        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);
        }
Exemplo n.º 25
0
        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");
            }
        }
Exemplo n.º 26
0
        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);
        }
Exemplo n.º 27
0
        public void SetData(NotificationEventTypeDataModel data)
        {
            SystemKeyId = data.NotificationEventTypeId;

            base.SetData(data);
        }
Exemplo n.º 28
0
        public static void Update(NotificationEventTypeDataModel data, RequestProfile requestProfile)
        {
            var sql = CreateOrUpdate(data, requestProfile, "Update");

            DBDML.RunSQL("Clent.Update", sql, DataStoreKey);
        }
Exemplo n.º 29
0
        public void SetData(NotificationEventTypeDataModel item)
        {
            SystemKeyId = item.NotificationEventTypeId;

            base.SetData(item);
        }
Exemplo n.º 30
0
 private void ReBindEditableGrid()
 {
     var data = new NotificationEventTypeDataModel();
     var dtNotificationEventType = Framework.Components.EventMonitoring.NotificationEventTypeDataManager.Search(data, SessionVariables.RequestProfile);
 }