Esempio n. 1
0
 public object ViewNotification(ParamNotificationView obj)
 {
     try
     {
         SchoolMainContext db = new ConcreateContext().GetContext(obj.userid, obj.password);
         var Notification     = db.VIEWNOTIFICATIONs.Where(r => r.UserId == obj.userid).ToList();
         if (Notification.Count == 0)
         {
             return(new Error()
             {
                 IsError = true, Message = "No Notifications Found"
             });
         }
         else
         {
             return(Notification);
         }
     }
     catch (Exception E)
     {
         return(new Error()
         {
             IsError = true,
             Message = E.Message
         });
     }
 }
 public object ViewNotification(ParamNotificationView obj)
 {
     try
     {
         var Notification = db.VIEWNOTIFICATIONs.Where(r => r.UserId == obj.userid).ToList();
         if (Notification.Count == 0)
         {
             return(new Error()
             {
                 IsError = true, Message = "No Notifications Found"
             });
         }
         else
         {
             return(Notification);
         }
     }
     catch (Exception E)
     {
         return(new Error()
         {
             IsError = true,
             Message = E.Message
         });
     }
 }
 public object ViewEventList(ParamNotificationView obj)
 {
     try
     {
         SchoolMainContext db = new ConcreateContext().GetContext(obj.userid, obj.password);
         if (db == null)
         {
             return(new Results()
             {
                 IsSuccess = false, Message = "Invalid User"
             });
         }
         var AcadamicYear = db.View_GETACADEMICYEAR.FirstOrDefault();
         if (AcadamicYear == null)
         {
             return(new Results
             {
                 IsSuccess = false,
                 Message = "Not Found Academic Year"
             });
         }
         // var Event = db.TBLHOLIDAYs.Where(r=>r.TYPE=="Event" && r.DISPLAY==1).ToList();
         DateTime TodayDate = DateTime.Now.Date;
         DateTime Remaining;
         Remaining = TodayDate.AddDays(+1);
         var Data = db.View_EventHolidayNotification.Where(r => r.ACADEMICYEAR == AcadamicYear.ACADEMICYEAR && r.STARTDATE == Remaining).ToList();
         //if(Data!=null)
         //{
         //    return new DivisionListResult() { IsSuccess = true, EventNotification = Data };
         //}
         if (Data == null)
         {
             return(new Results
             {
                 IsSuccess = false,
                 Message = new InvalidUser()
                 {
                     IsSuccess = false, Result = " No Record Found"
                 }
             });
         }
         else
         {
             return(new DivisionListResult()
             {
                 IsSuccess = true, EventNotification = Data
             });
         }
     }
     catch (Exception E)
     {
         return(new Results
         {
             IsSuccess = false,
             Message = E.Message
         });
     }
 }
Esempio n. 4
0
        public object ViewNotification([FromBody] ParamNotificationView obj)
        {
            NotificationBusiness objnote = new NotificationBusiness();

            return(new DivisionListResult()
            {
                IsSuccess = true, Notification = objnote.ViewNotification(obj)
            });
        }
        public object ViewEventHoliday(ParamNotificationView obj)
        {
            try
            {
                SchoolMainContext db = new ConcreateContext().GetContext(obj.userid, obj.password);
                if (db == null)
                {
                    return(new Results()
                    {
                        IsSuccess = false, Message = "Invalid User"
                    });
                }

                var EventHoliday = db.TBLHOLIDAYs.ToList().OrderByDescending(r => r.STARTDATE);

                if (EventHoliday == null)
                {
                    return(new Results
                    {
                        IsSuccess = false,
                        Message = new InvalidUser()
                        {
                            IsSuccess = false, Result = " No Record Found"
                        }
                    });
                }
                else
                {
                    return(new DivisionListResult()
                    {
                        IsSuccess = true, EventsList = EventHoliday
                    });
                }
            }
            catch (Exception E)
            {
                return(new Results
                {
                    IsSuccess = false,
                    Message = E.Message
                });
            }
        }
        public object ViewEventList(ParamNotificationView obj)
        {
            try
            {
                SchoolMainContext db = new ConcreateContext().GetContext(obj.userid, obj.password);
                if (db == null)
                {
                    return(new Results()
                    {
                        IsSuccess = false, Message = "Invalid User"
                    });
                }

                var Event = db.TBLNOTIFICATIONs.Where(r => r.NOTIFICATIONTYPE == "News" && r.ACADEMICYEAR == "2018-2019").ToList().OrderByDescending(r => r.NOTIFICATIONDATE);

                if (Event == null)
                {
                    return(new Results
                    {
                        IsSuccess = false,
                        Message = new InvalidUser()
                        {
                            IsSuccess = false, Result = " No Record Found"
                        }
                    });
                }
                else
                {
                    return(new DivisionListResult()
                    {
                        IsSuccess = true, EventNotification = Event
                    });
                }
            }
            catch (Exception E)
            {
                return(new Results
                {
                    IsSuccess = false,
                    Message = E.Message
                });
            }
        }
        public object ViewNotification(ParamNotificationView obj)
        {
            try
            {
                SchoolMainContext db = new ConcreateContext().GetContext(obj.userid, obj.password);
                if (db == null)
                {
                    return(new Results()
                    {
                        IsSuccess = false, Message = "Invalid User"
                    });
                }



                else
                {
                    var Notification = db.VIEWNOTIFICATIONs.Where(r => r.UserId == obj.userid).ToList().OrderByDescending(r => r.NOTIFICATIONID);
                    //var NotificationAll = db.VIEWALLNOTIFICATIONs.ToList().OrderByDescending(r => r.NOTIFICATIONID);
                    List <Result> lt = new List <Result>();


                    foreach (var att in Notification)
                    {
                        Result ddl = new Result();
                        ddl.TITLE            = att.TITLE;
                        ddl.NOTIFICATIONID   = att.NOTIFICATIONID;
                        ddl.NOTIFICATIONDATE = att.NOTIFICATIONDATE.ToString();
                        ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME;
                        ddl.UserId           = att.UserId.ToString();
                        ddl.STUDENTID        = att.STUDENTID.ToString();
                        ddl.STATUS           = att.STATUS.ToString();
                        ddl.UserType         = att.UserType;

                        lt.Add(ddl);
                    }

                    //foreach (var att in NotificationAll)
                    //{


                    //    Result ddl = new Result();
                    //    ddl.TITLE = att.TITLE;
                    //    ddl.NOTIFICATIONID = att.NOTIFICATIONID;
                    //    ddl.NOTIFICATIONDATE = att.NOTIFICATIONDATE.ToString();
                    //    ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME;
                    //    ddl.UserId = att.UserId.ToString();
                    //    ddl.STUDENTID = att.STUDENTID.ToString();
                    //    ddl.STATUS = att.STATUS.ToString();
                    //    ddl.UserType = att.UserType;

                    //    lt.Add(ddl);



                    //}

                    if (lt == null)
                    {
                        return(new Results
                        {
                            IsSuccess = false,
                            Message = "No Notifications Found"
                        });
                    }
                    else
                    {
                        return(new DivisionListResult()
                        {
                            IsSuccess = true, Notification = lt.ToList().OrderByDescending(r => r.NOTIFICATIONID)
                        });
                    }
                }
            }
            catch (Exception E)
            {
                return(new Results
                {
                    IsSuccess = false,
                    Message = E.Message
                });
            }
        }
        public object ViewAllNotification(ParamNotificationView obj)
        {
            try
            {
                SchoolMainContext db = new ConcreateContext().GetContext(obj.userid, obj.password);
                if (db == null)
                {
                    return(new Results()
                    {
                        IsSuccess = false, Message = "Invalid User"
                    });
                }
                else
                {
                    List <Result> lt = new List <Result>();
                    var           NotificationHome = db.VIEWNOTIFICATIONs.Where(r => r.UserId == obj.userid).ToList().OrderByDescending(r => r.NOTIFICATIONID);
                    //var NotificationAll = db.VIEWALLNOTIFICATIONs.ToList().OrderByDescending(r => r.NOTIFICATIONID);



                    foreach (var att in NotificationHome)
                    {
                        Result ddl = new Result();
                        ddl.TITLE            = att.TITLE;
                        ddl.NOTIFICATIONID   = att.NOTIFICATIONID;
                        ddl.NOTIFICATIONDATE = Convert.ToDateTime(att.NOTIFICATIONDATE);
                        ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME;
                        ddl.NOTIFICATIONTYPE = att.NOTIFICATIONTYPE;
                        ddl.UserId           = att.UserId.ToString();
                        ddl.STUDENTID        = att.STUDENTID.ToString();
                        ddl.STATUS           = att.STATUS.ToString();
                        ddl.UserType         = att.UserType;

                        lt.Add(ddl);
                    }

                    var Notification = db.VIEWGENERALNOTIFICATIONs.Where(r => r.UserId == obj.userid).ToList().OrderByDescending(r => r.NOTIFICATIONID);
                    //var NotificationAll = db.VIEWALLNOTIFICATIONs.ToList().OrderByDescending(r => r.NOTIFICATIONID);


                    if (Notification.Count() != 0)
                    {
                        foreach (var att in Notification)
                        {
                            Result ddl = new Result();
                            ddl.TITLE            = att.TITLE;
                            ddl.NOTIFICATIONID   = att.NOTIFICATIONID;
                            ddl.NOTIFICATIONDATE = Convert.ToDateTime(att.NOTIFICATIONDATE);
                            ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME;
                            ddl.NOTIFICATIONTYPE = att.NOTIFICATIONTYPE;
                            ddl.UserId           = att.UserId.ToString();
                            ddl.STUDENTID        = att.STUDENTID.ToString();
                            ddl.STATUS           = att.STATUS.ToString();
                            ddl.UserType         = att.UserType;

                            lt.Add(ddl);
                        }
                    }

                    var getUserType  = db.VW_GET_USER_TYPE.Where(r => r.UserId == obj.userid).FirstOrDefault();
                    var AcadamicYear = db.View_GETACADEMICYEAR.FirstOrDefault();
                    if (AcadamicYear == null)
                    {
                        return(new Results
                        {
                            IsSuccess = false,
                            Message = "Not Found Academic Year"
                        });
                    }
                    var Notificationgen = db.VIEWNOTIFICATIONGENs.Where(r => r.ACADEMICYEAR == AcadamicYear.ACADEMICYEAR).ToList().OrderByDescending(r => r.NOTIFICATIONID);

                    if (Notificationgen.Count() != 0)
                    {
                        foreach (var att in Notificationgen)
                        {
                            Result ddl = new Result();
                            ddl.TITLE            = att.TITLE;
                            ddl.NOTIFICATIONID   = att.NOTIFICATIONID;
                            ddl.NOTIFICATIONDATE = Convert.ToDateTime(att.NOTIFICATIONDATE);
                            ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME;
                            ddl.NOTIFICATIONTYPE = att.NOTIFICATIONTYPE;
                            ddl.UserId           = obj.userid.ToString();
                            ddl.STUDENTID        = "";
                            ddl.STATUS           = "";
                            ddl.UserType         = getUserType.UserType;

                            lt.Add(ddl);
                        }
                    }



                    if (lt == null)
                    {
                        return(new Results
                        {
                            IsSuccess = false,
                            Message = "No Notifications Found"
                        });
                    }
                    else
                    {
                        return(new DivisionListResult()
                        {
                            IsSuccess = true, AllNotification = lt.OrderByDescending(r => Convert.ToDateTime(r.NOTIFICATIONDATE)).ToList()
                        });
                    }
                }
            }
            catch (Exception E)
            {
                return(new Results
                {
                    IsSuccess = false,
                    Message = E.Message
                });
            }
        }
Esempio n. 9
0
        public object ViewEventHoliday([FromBody] ParamNotificationView obj)
        {
            NotificationBusiness objnote = new NotificationBusiness();

            return(objnote.ViewEventHoliday(obj));
        }
Esempio n. 10
0
        public object ViewAllNotification([FromBody] ParamNotificationView obj)
        {
            NotificationBusiness objnote = new NotificationBusiness();

            return(objnote.ViewAllNotification(obj));
        }