Beispiel #1
0
        public void AlertNames()
        {
            IQueryable <AlertNames> AlertNamesCollection = Enumerable.Empty <AlertNames>().AsQueryable();
            AlertNames ct = new AlertNames {
                AlertNameID = 1, NameEntry = "Test AlertNames"
            };

            Mock <IAlertNamesRepository> AlertNamesService = new Mock <IAlertNamesRepository>();

            object obj = new object();

            try
            {
                AlertNamesService.Setup(x => x.GetAll()).Returns(AlertNamesCollection);
                AlertNamesService.Setup(x => x.Get(It.IsAny <int>())).Returns(ct);

                var AlertNamesObject = AlertNamesService.Object;
                var p1 = AlertNamesObject.GetAll();
                var p2 = AlertNamesObject.Get(1);

                Assert.IsAssignableFrom <IQueryable <AlertNames> >(p1);
                Assert.IsAssignableFrom <AlertNames>(p2);
                Assert.Equal("Test AlertNames", p2.NameEntry);

                AlertNamesService.VerifyAll();

                AlertNamesObject.Dispose();
            }
            finally
            {
                AlertNamesService = null;
            }
        }
Beispiel #2
0
        public string EventnamebyKey(int id)
        {
            string     eventName   = "";
            DataTable  Alerttab    = new DataTable();
            AlertNames ReturnAlert = new AlertNames();

            try
            {
                string SqlQuery = "Select name from ELS where ID=" + id.ToString();
                Alerttab = objAdaptor.FetchData(SqlQuery);

                if (!DBNull.Value.Equals(Alerttab.Rows[0]["name"]))
                {
                    eventName = Alerttab.Rows[0]["name"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return(eventName);
        }
Beispiel #3
0
        public DataTable GetDataByAlertName(DominoEventLog NameObj)
        {
            DataTable  AlertDataTable = new DataTable();
            AlertNames Returnobject   = new AlertNames();

            try
            {
                if (NameObj.ID == 0)
                {
                    string SqlQuery = "SELECT * FROM [DominoEventLog] where Name='" + NameObj.Name + "'";
                    //string SqlQuery = "SELECT * FROM Servers";
                    AlertDataTable = objAdaptor.FetchData(SqlQuery);
                }
                else
                {
                    //7/3/2013 NS modified
                    //string SqlQuery = "SELECT * FROM [Users] where LoginName='" + AlertsObject.AlertName + "' and AlertKey<>'" + AlertsObject.AlertKey + "'";
                    string SqlQuery = "SELECT * FROM [DominoEventLog] where Name='" + NameObj.Name + "' and ID<>" + NameObj.ID;
                    AlertDataTable = objAdaptor.FetchData(SqlQuery);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return(AlertDataTable);
        }
Beispiel #4
0
 public AlertNames GetAlertNamebyKey(AlertNames Alertobj)
 {
     try
     {
         return(VSWebDAL.ConfiguratorDAL.AlertsDAL.Ins.AlertnamebyKey(Alertobj));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #5
0
 //4/2/2015 NS added for VSPLUS-219
 public DataTable GetEscalationDetails(AlertNames Alertobj)
 {
     try
     {
         return(VSWebDAL.ConfiguratorDAL.AlertsDAL.Ins.GetEscalationData(Alertobj));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #6
0
 public Object DeleteAlert(AlertNames Alert)
 {
     try
     {
         return(VSWebDAL.ConfiguratorDAL.AlertsDAL.Ins.DeleteAlert(Alert));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #7
0
 public DataTable GetDataByAlertName(AlertNames AlertsObject)
 {
     try
     {
         return(VSWebDAL.ConfiguratorDAL.AlertsDAL.Ins.GetDataByAlertName(AlertsObject));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #8
0
 public bool UpdateName(AlertNames obj)
 {
     try
     {
         return(VSWebDAL.ConfiguratorDAL.AlertsDAL.Ins.UpdateName(obj));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #9
0
 public bool InsertAlertName(AlertNames Aobj)
 {
     try
     {
         return(VSWebDAL.ConfiguratorDAL.AlertsDAL.Ins.InsertName(Aobj));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #10
0
        internal void PopulateData()
        {
            using (var context = new AppDbContext(options, null))
            {
                if (context.AlertJobs.Count() < 1)
                {
                    var p1 = new AlertJobs {
                        AlertJobsID = 1, JobName = "AlertJobs 1"
                    };
                    var p2 = new AlertJobs {
                        AlertJobsID = 2, JobName = "AlertJobs 2"
                    };
                    context.AlertJobs.Add(p1);
                    context.AlertJobs.Add(p2);

                    context.SaveChanges();
                }

                if (context.AlertNames.Count() < 1)
                {
                    var p1 = new AlertNames {
                        AlertNameID = 1, NameEntry = "AlertNames 1", AlertJobsID = 1
                    };
                    var p2 = new AlertNames {
                        AlertNameID = 2, NameEntry = "AlertNames 2", AlertJobsID = 2
                    };
                    context.AlertNames.Add(p1);
                    context.AlertNames.Add(p2);

                    context.SaveChanges();
                }

                if (context.AlertJobsQueue.Count() < 1)
                {
                    var p1 = new AlertJobsQueue {
                        AlertJobsQueueID = 1, CreatedBy = "6", StatusCollectionItemID = 1047
                    };
                    var p2 = new AlertJobsQueue {
                        AlertJobsQueueID = 2, CreatedBy = "6", StatusCollectionItemID = 1047
                    };
                    context.AlertJobsQueue.Add(p1);
                    context.AlertJobsQueue.Add(p2);

                    context.SaveChanges();
                }
            }
        }
Beispiel #11
0
        protected void AlertDefGridView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            AlertNames Alertobj = new AlertNames();

            Alertobj.AlertKey = Convert.ToInt32(e.Keys[0]);
            try
            {
                VSWebBL.ConfiguratorBL.AlertsBL.Ins.DeleteAlert(Alertobj);
            }
            catch (Exception ex)
            {
                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
            }
            ASPxGridView gridview = (ASPxGridView)sender;

            gridview.CancelEdit();
            e.Cancel = true;
            fillGrid();
        }