Ejemplo n.º 1
0
        public ActionResult UpdateItemList(int itemId, int id, string solved, string notes, string cost)
        {
            string   userID      = FindUserID();
            ListRepo repw        = new ListRepo();
            bool     solveoption = false;
            decimal  valueCost   = 0;

            if (solved == "true")
            {
                solveoption = true;
            }
            try
            {
                valueCost = decimal.Parse(cost);
            }
            catch
            {
                valueCost = 0;
            }

            if (repw.updateItemList(userID, itemId, id, solveoption, valueCost, notes))
            {
                ViewBag.ActionMsg = "Task  Deleted from List Successfully.";
            }
            else
            {
                ViewBag.DeleteMsg = "Error deleting Task from List";
            }

            return(RedirectToAction("EditList", new { id = id }));
        }
Ejemplo n.º 2
0
        public ActionResult ShowAllList()
        {
            string   UserID = FindUserID();
            ListRepo r      = new ListRepo();
            IEnumerable <ListViewVM> listsummary = r.GetLists(UserID);

            return(View(listsummary));
        }
Ejemplo n.º 3
0
        public ActionResult DeleteItemList(int itemId, int id)
        {
            ListRepo repw = new ListRepo();

            if (repw.deleteItemList(itemId, id))
            {
                ViewBag.ActionMsg = "Task  Deleted from List Successfully.";
            }

            return(RedirectToAction("EditList", new { id = id }));
        }
Ejemplo n.º 4
0
 public ActionResult Home()
 {
     if (Request.IsAuthenticated)
     {
         ViewBag.UserName = User.Identity.Name;
         ListRepo r = new ListRepo();
         IEnumerable <ListViewVM> listsummary = r.GetLists(FindUserID());
         return(View(listsummary));
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Ejemplo n.º 5
0
 public ActionResult ShowCompleteList()
 {
     if (Request.IsAuthenticated)
     {
         string   UserID = FindUserID();
         ListRepo r      = new ListRepo();
         IEnumerable <ListViewVM> listsummary = r.GetCompletedLists(UserID);
         return(View(listsummary));
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Ejemplo n.º 6
0
 public ActionResult CreateList()
 {
     if (Request.IsAuthenticated)
     {
         ListRepo rep       = new ListRepo();
         string   userID    = FindUserID();
         ListVM   cleanList = rep.CreateList(userID);
         return(View(cleanList));
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Ejemplo n.º 7
0
        public ActionResult ListManagement()
        {
            //bring List per user
            if (Request.IsAuthenticated)
            {
                string   UserID = FindUserID();
                ListRepo r      = new ListRepo();
                IEnumerable <ListViewVM> listsummary = r.GetLists(UserID);

                return(View(listsummary));
            }
            else
            {
                return(RedirectToAction("Login", "Home"));
            }
        }
Ejemplo n.º 8
0
        public ActionResult CompleteList(int id)
        {
            ListRepo rep       = new ListRepo();
            string   userID    = FindUserID();
            bool     cleanList = rep.CompleteList(id, userID);

            if (cleanList == true)
            {
                ViewBag.ActionMsg = "List Added Successfully.";
            }
            else
            {
                ViewBag.ErrorMsg = "Cannot complete List.";
            }
            return(RedirectToAction("ListManagement", "Home"));
        }
Ejemplo n.º 9
0
        public ActionResult EditList(int id)
        {
            //send the information to get the list and the user type

            if (!Request.IsAuthenticated)
            {
                //that list doesnt exist or he has no rights for that list, return to list management
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                string     userID = FindUserID();
                ListRepo   repw   = new ListRepo();
                ListViewVM list   = repw.getList(id, userID);
                //show list
                return(View(list));
            }
        }
Ejemplo n.º 10
0
        public ActionResult EditList(ListViewVM view)
        {
            string   userID = FindUserID();
            ListRepo rep    = new ListRepo();
            bool     result = rep.UpdateListData(view.ListID, view.ListName, view.ListTypeID, view.SuscribergroupID);

            if (result == true)
            {
                TempData["ActionMsg"] = "List Updated Successfully.";
            }
            else
            {
                TempData["ErrorMsg"] = "Couldn't udpate list.";
            }


            return(RedirectToAction("EditList", new { id = view.ListID }));
        }
Ejemplo n.º 11
0
 public ActionResult ShowSubscribedList()
 {
     if (Request.IsAuthenticated)
     {
         string   UserID = FindUserID();
         ListRepo r      = new ListRepo();
         IEnumerable <ListViewVM> listsummary = r.GetSuscribedLists(UserID);
         if (listsummary != null)
         {
             return(View(listsummary));
         }
         else
         {
             return(RedirectToAction("ListManagement", "Home"));
         }
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Ejemplo n.º 12
0
 public ActionResult DeleteList(int id)
 {
     //delete the list
     try
     {
         ListRepo repw      = new ListRepo();
         string   userID    = FindUserID();
         bool     cleanList = repw.DeleteList(id);
         if (cleanList == true)
         {
             ViewBag.ActionMsg = "List Deleted Successfully.";
         }
         else
         {
             ViewBag.ErrorMsg = "Cannot Delete List.";
         }
     }
     catch
     {
         ViewBag.ErrorMsg = "Cannot Delete List.";
     }
     return(RedirectToAction("ListManagement", "Home"));
 }
Ejemplo n.º 13
0
        public ActionResult ExportXLSXList(QueryCompanyModel model)
        {
            var companyListData = ListRepo.Query(model);

            return(File(ListRepo.ExportXLSX(companyListData), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "客戶清單資料.xlsx"));
        }
Ejemplo n.º 14
0
        public ActionResult ExportXLSList(QueryCompanyModel model)
        {
            var companyListData = ListRepo.Query(model);

            return(File(ListRepo.ExportXLS(companyListData), "application/vnd.ms-excel", "客戶清單資料.xls"));
        }
Ejemplo n.º 15
0
 // GET: /Company/List
 public ActionResult List(QueryCompanyModel model)
 {
     return(View(ListRepo.Query(model, 1)));
 }
Ejemplo n.º 16
0
        public ActionResult CreateList(FormCollection formCollection)
        {
            string   userID  = FindUserID();
            ListRepo rep     = new ListRepo();
            ListVM   NewList = new ListVM();

            if (ModelState.IsValid)
            {
                foreach (string key in formCollection.AllKeys)
                {
                    switch (key)
                    {
                    case "ListName":
                        NewList.ListName = formCollection[key];
                        break;

                    case "ListType":
                        NewList.ListTypeID = int.Parse(formCollection[key]);
                        break;

                    case "ItemCategory":
                        NewList.ItemCategoryID = int.Parse(formCollection[key]);
                        break;

                    case "SuscriberGroup":
                        NewList.SuscribergroupID = formCollection[key];
                        break;
                    }
                }

                NewList.CreatorID    = userID;
                NewList.CreationDate = DateTime.Now;
                if (NewList.ListName.Trim().Length < 1)
                {
                    ViewBag.InputErrorMsg = "List name is required.";
                    return(View(rep.CreateList(userID)));
                }
                else
                {
                    rep.CreateList(NewList);

                    //if (resp == false)
                    //{
                    //    TempData["ErrorMsg"] = "Cannot add List.";
                    //    ViewBag.ErrorMsg = "Cannot add List.";
                    //    return View(rep.CreateList(userID));
                    //}
                    //else
                    //{
                    //    TempData["ActionMsg"] = "List Added Successfully";
                    //    ViewBag.ActionMsg = "List Added Successfully.";
                    return(RedirectToAction("ListManagement", "Home"));
                    //}
                }
            }
            else
            {
                TempData["ErrorMsg"] = "Cannot add List.";
                ViewBag.ErrorMsg     = "Cannot add List.";
                return(View(rep.CreateList(userID)));
            }
        }