コード例 #1
0
        public ActionResult Add()
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                ViewBag.CompanyLogo = loginsession.CompanyLogo;
                ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType));
                ViewBag.RoleName = loginsession.RoleName;
                Notifycation notify = new Notifycation();
                notify.Notifiy = BAL.Common.GetnotificationMode();
                if (loginsession.ClientID != null)
                {
                    ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text");
                }
                else
                { ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text");
                }

                ViewBag.DayOfMonthList = new SelectList(BAL.Common.GetMonthDay(), "Value", "Text");
                ViewBag.Type = new SelectList(BAL.NotificationModel.NotificationTypeDropDownList().Where(c=>c.Value!="3"), "Value", "Text");
                ViewBag.NoticationDay = new SelectList(BAL.Common.WeekdaysDropDownList(), "Value", "Text");
                return View(notify);
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
コード例 #2
0
        public ActionResult Create(Notifycation model)
        {
            if (Session["Login"] != null)
            {
            LoginSession loginsession = (LoginSession)Session["Login"];
            ViewBag.CompanyLogo = loginsession.CompanyLogo;
            ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
            String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
            String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType));
            ViewBag.RoleName = loginsession.RoleName;

            if (String.IsNullOrEmpty(model.NotificationName))
            {
                ModelState.AddModelError("Notify", "Please Enter NotifyName");
            }

            if (String.IsNullOrEmpty(model.SelectNotificationMode.ToString().Trim()))
            {
                ModelState.AddModelError("Notification Mode", "You did not select any notification Mode");
            }

            if (ModelState.IsValid)
            {
                try
                {
                    model.SelectNotificationMode = model.SelectNotificationMode.ToString().Trim();
                    model.CreateBy = Convert.ToInt64(loginsession.UserID);
                    if (NotificationModel.CreateNotification(model))
                    {
                        return Json(new { result = 1, message = "Record was successfully Saved!" });
                    }
                    else
                    {
                        return Json(new { result = 0, message = "Duplicate Notification Name " });
                    }
                }
                catch (Exception ex)
                {
                    return Json(new { result = 0, message = "ErrorMessage" + ":" + ex.StackTrace.ToString() });
                }
            }
            else
            {
                String errorMessage = String.Empty;
                String exception = String.Empty;
                foreach (var modelStateVal in ViewData.ModelState.Values)
                {
                    foreach (var error in modelStateVal.Errors)
                    {
                        errorMessage = error.ErrorMessage;
                        exception = error.Exception.ToString();
                    }
                }

                //------------------------------------
                if (loginsession.ClientID != null)
                {
                    ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text");
                }
                else
                {
                    ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text");
                }

                ViewBag.Type = new SelectList(BAL.NotificationModel.NotificationTypeDropDownList().Where(c => c.Value == "3"), "Value", "Text");
                ViewBag.NoticationDay = new SelectList(BAL.Common.WeekdaysDropDownList(), "Value", "Text");

                //------------------------------
                return Json(new { result = 0, message = "ErrorMessage" + ":" + exception });
            }
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
コード例 #3
0
        public ActionResult Update(Notifycation model)
        {
            if (Session["Login"] != null)
            {

                if (String.IsNullOrEmpty(model.SelectNotificationMode.ToString().Trim()))
                {
                    ModelState.AddModelError("Notification Mode", "You did not select any notification Mode");
                }

                if (ModelState.IsValid)
                {
                    try
                    {
                        LoginSession loginsession = (LoginSession)Session["Login"];
                        model.SelectNotificationMode = model.SelectNotificationMode.ToString().Trim();
                        model.modifyBy = Convert.ToInt64(loginsession.UserID);
                        if (NotificationModel.UpdateNotifycation(model))
                        {
                            String nType = model.PType;
                            return RedirectToAction("Index", "Notify", new { Type = BAL.Security.URLEncrypt(nType) });
                        }
                        else
                        {
                            // return Json(new { result = 0, message = "Duplicate Currency Name " });
                            return Content("Unable to save , try again");

                        }
                    }
                    catch (Exception ex)
                    {
                        return Content("ErrorMessage" + ":" + ex.StackTrace.ToString());
                    }
                }
                else
                {
                    String errorMessage = String.Empty;
                    String exception = String.Empty;
                    foreach (var modelStateVal in ViewData.ModelState.Values)
                    {
                        foreach (var error in modelStateVal.Errors)
                        {
                            errorMessage = error.ErrorMessage;
                            exception = error.Exception.ToString();
                        }
                    }
                    return Content("ErrorMessage" + ":" + exception);
                }
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
コード例 #4
0
        public ActionResult Edit(String Notify_ID, String Type)
        {
            if (Session["Login"] != null)
            {
                 LoginSession loginsession = (LoginSession)Session["Login"];
            ViewBag.CompanyLogo = loginsession.CompanyLogo;
            ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
            String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
            String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, BAL.Common.LayoutType(loginsession.UserType));
            ViewBag.RoleName = loginsession.RoleName;

                if (Notify_ID != null)
                {
                    String Dec_Notify_ID = BAL.Security.URLDecrypt(Notify_ID);
                    String DecType = BAL.Security.URLDecrypt(Type);
                    ViewBag.SType = DecType;
                    if ((Dec_Notify_ID != "0") && (Dec_Notify_ID != null))
                    {
                        Notifycation notify = new Notifycation();
                        try
                        {
                            notify = BAL.NotificationModel.EditNotifycation(Dec_Notify_ID);
                            ViewBag.Notyfy_ID = notify.NotificationID;
                            List<BAL.Notification> list =BAL.Common.GetnotificationMode();
                            if (notify.SelectNotificationMode != null)
                            {
                                foreach (var item in list.Where(w => w.ID == notify.SelectNotificationMode))
                                {
                                    item.IsSelect = true;
                                }
                            }

                            notify.Notifiy = list;

                            if (notify.NotificationDay != null)
                            {
                                ViewBag.NoticationDayList = new SelectList(BAL.Common.WeekdaysDropDownList(), "Value", "Text", notify.NotificationDay);

                            }
                            else
                            {
                                ViewBag.NoticationDayList = new SelectList(BAL.Common.WeekdaysDropDownList(), "Value", "Text");
                            }

                            if ((notify.DayOfMonth != null)&&(!String.IsNullOrEmpty(notify.DayOfMonth)))
                            {
                                ViewBag.DayOfMonthList = new SelectList(BAL.Common.GetMonthDay(), "Value", "Text", notify.DayOfMonth);
                            }
                            else { ViewBag.DayOfMonthList = new SelectList(BAL.Common.GetMonthDay(), "Value", "Text"); }

                  if (loginsession.ClientID != null)
                {
                      if(notify.ClientID != null)
                      {
            ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text",notify.ClientID);

                      }
                      else{
                      ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text");
                      }

                      if ((notify.SiteID != null) && (notify.ClientID != null))
                      {
                          ViewBag.Site = new SelectList(BAL.SiteModel.SiteDropDownList(loginsession.UserID.ToString(), Convert.ToInt64(notify.ClientID), loginsession.UserType.ToString(), loginsession.RoleName), "Value", "Text", notify.SiteID);

                      }
                      else
                      {

            ViewBag.Site = new SelectList(BAL.SiteModel.SiteDropDownList(loginsession.UserID.ToString(), Convert.ToInt64(notify.ClientID), loginsession.UserType.ToString(), loginsession.RoleName), "Value", "Text");

                      }
                }
                else
                {

                       if(notify.ClientID != null)
                      {
                ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text",notify.ClientID);
                      }
                      else{
               ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text");
                      }

                       if ((notify.SiteID != null) && (notify.ClientID != null))
                       {
               ViewBag.Site = new SelectList(BAL.SiteModel.SiteDropDownList(loginsession.UserID.ToString(), Convert.ToInt64(notify.ClientID), loginsession.UserType.ToString(), loginsession.RoleName), "Value", "Text", notify.SiteID);

                       }
                       else
                       {
              ViewBag.Site = new SelectList(BAL.SiteModel.SiteDropDownList(loginsession.UserID.ToString(), Convert.ToInt64(notify.ClientID), loginsession.UserType.ToString(), loginsession.RoleName), "Value", "Text");

                       }

                }

                            if (DecType.Trim() == "1")
                            {
                                ViewBag.Type = new SelectList(BAL.NotificationModel.NotificationTypeDropDownList().Where(c => c.Value == "3"), "Value", "Text", notify.TypeID);
                                ViewBag.BlockTitle = "Billing";
                            }
                            else
                            {
                                ViewBag.Type = new SelectList(BAL.NotificationModel.NotificationTypeDropDownList().Where(c => c.Value != "3"), "Value", "Text", notify.TypeID);
                                ViewBag.BlockTitle = "Notification";
                            }

                            //if (notify.NotificationDate != null)
                            //{
                            //    ViewBag.NoticationDay = new SelectList(BAL.Common.WeekdaysNameDropdownList(), "Value", "Text", notify.NotificationDate);
                            //}
                            //else { ViewBag.NoticationDay = new SelectList(BAL.Common.WeekdaysNameDropdownList(), "Value", "Text"); }

                         //   ViewBag.NoticationDayList = new SelectList(BAL.Common.WeekdaysNameDropdownList(), "Value", "Text");

                        }
                        catch (Exception ex)
                        { return Content(ex.Message); }
                        return View(notify);
                    }
                }
                {
                    return RedirectToAction("Index", "Notify");
                }
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
コード例 #5
0
 public static bool UpdateNotifycation(Notifycation Notify)
 {
     Boolean flag = false;
     try
     {
     Icontext objinter = new BALNotifycation();
     flag = objinter.UpdateRecord(Notify);
     }
     catch (Exception ex)
     {
     throw;
     }
     return flag;
 }
コード例 #6
0
 public static Boolean CreateNotification(Notifycation Notify)
 {
     Boolean flag = false;
     try
     {
     Icontext objtext = new BALNotifycation();
     flag = objtext.CreateRecord(Notify);
     }
     catch (Exception ex)
     {
     throw;
     }
     return flag;
 }
コード例 #7
0
        public Object EditRecord(Int64 NotifyID)
        {
            Notifycation _Notify = new Notifycation();
            try
            {
            NotificationMaster notify = DAL.DALNotification.EditNotification(Convert.ToInt32(NotifyID));
            _Notify.NotificationID = notify.NotificationID;

            if (notify.ClientID != null)
            {
                _Notify.ClientID = notify.ClientID;
            }

            if (notify.SiteID != null)
            {
                _Notify.SiteID = notify.SiteID;
            }

            if (!String.IsNullOrEmpty(notify.NotificationName))
            {
                _Notify.NotificationName = notify.NotificationName;
            }

            if (notify.Type != null)
            {
                _Notify.TypeID = notify.Type;
            }

            if (notify.NoOfDays != null)
            {
                _Notify.Days = notify.NoOfDays.ToString();
            }
            if (notify.DayOfMonth != null)
            {
                _Notify.DayOfMonth = notify.DayOfMonth.Trim();
            }
            if (notify.NotificationMode != null)
            {
                _Notify.SelectNotificationMode = notify.NotificationMode.ToString();
            }

            if (notify.NotificationDay != null)
            {
                _Notify.NotificationDay = notify.NotificationDay;
            }
            }
            catch (Exception ex)
            {
            throw;
            }
            return _Notify;
        }