Example #1
0
        public ActionResult DeleteConfirmed(int ListHeaderID)
        {
            listheader listheader = ListHeaderRepository.GetListHeaderByID(ListHeaderID);

            ListHeaderRepository.DeleteRecord(listheader);
            return(RedirectToAction("Index"));
        }
Example #2
0
        public ActionResult Create(int ListTableID)
        {
            GetData();
            ViewBag.BeginDate   = DateTime.Today;
            ViewBag.ListTableID = ListTableID;
            listtable table = ListTableRepository.GetListByID(ListTableID);

            if (table == null)
            {
                return(Content("Table not found"));
            }
            ViewBag.TableName = string.Format("Add record to table ({0})", table.Title);
            listheader header = ListHeaderRepository.GetByListTableID(ListTableID);

            ViewBag.TableHeaderID = header.ListHeaderID;
            ViewBag.Type1         = header.Type1;
            ViewBag.Type2         = header.Type2;
            ViewBag.Type3         = header.Type3;
            ViewBag.Type4         = header.Type4;
            ViewBag.Type5         = header.Type5;
            ViewBag.Type6         = header.Type6;
            ViewBag.Type7         = header.Type7;
            ViewBag.Type8         = header.Type8;
            ViewBag.Type9         = header.Type9;
            ViewBag.Type10        = header.Type10;

            return(PartialView(new listitem {
                DateEntered = System.DateTime.Today, EnteredBy = User.Identity.Name.ToString(), listTableID = ListTableID, Status = "Active"
            }));
        }
Example #3
0
        //
        // GET: /ListHeader/Delete/5

        public ActionResult Delete(int ListHeaderID)
        {
            ViewBag.ListHeaderID = ListHeaderID;
            listheader listheader = ListHeaderRepository.GetListHeaderByID(ListHeaderID);

            return(PartialView(listheader));
        }
Example #4
0
        public ActionResult ListStatus(int ListTableID, string Status)
        {
            ViewBag.ListTableID = ListTableID;
            listtable  table  = ListTableRepository.GetListByID(ListTableID);
            listheader header = ListHeaderRepository.GetByListTableID(ListTableID);

            ViewBag.Header = header;

            IEnumerable <listitem> ListItem;

            ListItem            = ListItemRepository.GetListItemByListStatus(ListTableID, Status);
            ViewBag.RecordCount = ListItem.Count();

            //security
            ViewBag.Supervisor = false;
            int memberID = Convert.ToInt16(System.Web.HttpContext.Current.Session["personID"]);

            if (MembershipRepositroy.IsUser(memberID))
            {
                user user = MembershipRepositroy.GetUserByID(memberID);
                if ((user.role.Name == "WebMaster") || (user.role.Name == "Officer") || (user.role.Name == "Admin")) //creator access
                {
                    ViewBag.Supervisor = true;
                }
            }

            return(PartialView(ListItem));
        }
Example #5
0
        public ActionResult DeleteConfirmed(int ListTableID)
        {
            listtable listtable           = ListTableRepository.GetListByID(ListTableID);
            IEnumerable <listitem> litems = ListItemRepository.GetAllListItemByListTable(ListTableID);

            ListItemRepository.DeleteAllRecords(litems);
            listheader header = ListHeaderRepository.GetByListTableID(ListTableID);

            ListHeaderRepository.DeleteRecord(header);
            ListTableRepository.DeleteRecord(listtable);

            //return RedirectToAction("List");
            return(Content("Table deleted successfully"));
        }
Example #6
0
        public ActionResult List(int ListTableID, bool canEdit = true)
        {
            ViewBag.CanEdit     = canEdit;
            ViewBag.ListTableID = ListTableID;
            listtable table = ListTableRepository.GetListByID(ListTableID);

            ViewBag.TableName = table.Title;
            listheader header = ListHeaderRepository.GetByListTableID(ListTableID);

            ViewBag.Header = header;

            IEnumerable <listitem> ListItem = null;

            // ListItem = ListItemRepository.GetListItemByList(ListTableID);
            //ViewBag.RecordCount = ListItem.Count();

            //security
            ViewBag.Supervisor = false;
            int memberID = Convert.ToInt16(System.Web.HttpContext.Current.Session["personID"]);

            if (MembershipRepositroy.IsUser(memberID))
            {
                user user = MembershipRepositroy.GetUserByID(memberID);
                if ((user.role.Name == "WebMaster") || (user.role.Name == "Officer") || (user.role.Name == "Admin")) //creator access
                {
                    ViewBag.Supervisor  = true;
                    ListItem            = ListItemRepository.GetAllListItemByListTable(ListTableID);
                    ViewBag.RecordCount = ListItem.Count();
                }
                else
                {
                    ListItem            = ListItemRepository.GetActiveListItemByListTable(ListTableID);
                    ViewBag.RecordCount = ListItem.Count();
                }
            }

            ViewBag.HasComment = false;
            foreach (listitem i in ListItem)
            {
                if (i.Comment.Trim() != "")
                {
                    ViewBag.HasComment = true;
                }
            }
            return(PartialView(ListItem));
        }
Example #7
0
        public ActionResult Display(int ListTableID, bool canEdit = true)
        {
            ViewBag.CanEdit     = canEdit;
            ViewBag.ListTableID = ListTableID;
            listtable              table  = ListTableRepository.GetListByID(ListTableID);
            listheader             header = ListHeaderRepository.GetByListTableID(ListTableID);
            IEnumerable <listitem> items  = ListItemRepository.GetAllListItemByListTable(ListTableID);

            ViewBag.HasHeader = false;
            if (header != null)
            {
                ViewBag.HasHeader = true;
            }



            return(PartialView(table));
        }
Example #8
0
        public ActionResult Edit(int ListItemID)
        {
            listitem listitem = ListItemRepository.GetListItemByID(ListItemID);

            GetData();
            listtable table = ListTableRepository.GetListByID(listitem.listTableID);

            ViewBag.TableName = string.Format("Add new record to the{0}", table.Title);
            listheader header = ListHeaderRepository.GetByListTableID(listitem.listTableID);

            ViewBag.Type1  = header.Type1;
            ViewBag.Type2  = header.Type2;
            ViewBag.Type3  = header.Type3;
            ViewBag.Type4  = header.Type4;
            ViewBag.Type5  = header.Type5;
            ViewBag.Type6  = header.Type6;
            ViewBag.Type7  = header.Type7;
            ViewBag.Type8  = header.Type8;
            ViewBag.Type9  = header.Type9;
            ViewBag.Type10 = header.Type10;

            return(PartialView(listitem));
        }
Example #9
0
 public void DeleteRecord(listheader record)
 {
     myRecords.Remove(record);
     context.listheaders.Remove(record);
     context.SaveChanges();
 }
Example #10
0
 public listheader  GetByListTableID(int ListTableID)
 {
     record = myRecords.FirstOrDefault(e => e.ListTableID == ListTableID);
     return(record);
 }
Example #11
0
 public listheader GetListHeaderByID(int ListHeaderID)
 {
     record = myRecords.FirstOrDefault(e => e.ListHeaderID == ListHeaderID);
     return(record);
 }
Example #12
0
 public void AddRecord(listheader Record)
 {
     myRecords.Add(record);
 }
Example #13
0
        public ActionResult Create(listheader listheader)
        {
            try
            {
                // if (listheader.Type1 == null) { listheader.Type1 = ""; }
                if (listheader.Type2 == null)
                {
                    listheader.Type2 = "";
                }
                if (listheader.Type3 == null)
                {
                    listheader.Type3 = "";
                }
                if (listheader.Type4 == null)
                {
                    listheader.Type4 = "";
                }
                if (listheader.Type5 == null)
                {
                    listheader.Type5 = "";
                }
                if (listheader.Type6 == null)
                {
                    listheader.Type6 = "";
                }
                if (listheader.Type7 == null)
                {
                    listheader.Type7 = "";
                }
                if (listheader.Type8 == null)
                {
                    listheader.Type8 = "";
                }
                if (listheader.Type9 == null)
                {
                    listheader.Type9 = "";
                }
                if (listheader.Type10 == null)
                {
                    listheader.Type10 = "";
                }

                // if (listheader.FieldName1 == null) { listheader.FieldName1 = ""; }
                if (listheader.FieldName2 == null)
                {
                    listheader.FieldName2 = "";
                }
                if (listheader.FieldName3 == null)
                {
                    listheader.FieldName3 = "";
                }
                if (listheader.FieldName4 == null)
                {
                    listheader.FieldName4 = "";
                }
                if (listheader.FieldName5 == null)
                {
                    listheader.FieldName5 = "";
                }
                if (listheader.FieldName6 == null)
                {
                    listheader.FieldName6 = "";
                }
                if (listheader.FieldName7 == null)
                {
                    listheader.FieldName7 = "";
                }
                if (listheader.FieldName8 == null)
                {
                    listheader.FieldName8 = "";
                }
                if (listheader.FieldName9 == null)
                {
                    listheader.FieldName9 = "";
                }
                if (listheader.FieldName10 == null)
                {
                    listheader.FieldName10 = "";
                }

                if (ModelState.IsValid)
                {
                    listtable table = new listtable();
                    table.ministryID  = listheader.ministryID;
                    table.Title       = listheader.TableName;
                    table.Status      = "Active";
                    table.ministryID  = listheader.ministryID;
                    table.EnteredBy   = User.Identity.Name.ToString();
                    table.DateEntered = System.DateTime.Today;
                    table.DateCreated = System.DateTime.Today;
                    ListTableRepository.AddRecord(table);

                    listheader.ListTableID = table.listTableID;
                    db.listheaders.Add(listheader);
                    db.SaveChanges();
                    ListHeaderRepository.AddRecord(listheader);
                    TempData["Message2"] = "Table header added successfully.";
                    GetData();
                    return(RedirectToAction("Create", "ListItem", new { ListTableID = listheader.ListTableID }));
                }
            }
            catch (Exception ex)
            {
                TempData["Message2"] = "Error adding table header";
            }
            GetData();

            return(PartialView(listheader));
        }
Example #14
0
        public ActionResult Edit(listheader listheader)
        {
            try
            {
                // if (listheader.Type1 == null) { listheader.Type1 = ""; }
                if (listheader.Type2 == null)
                {
                    listheader.Type2 = "";
                }
                if (listheader.Type3 == null)
                {
                    listheader.Type3 = "";
                }
                if (listheader.Type4 == null)
                {
                    listheader.Type4 = "";
                }
                if (listheader.Type5 == null)
                {
                    listheader.Type5 = "";
                }
                if (listheader.Type6 == null)
                {
                    listheader.Type6 = "";
                }
                if (listheader.Type7 == null)
                {
                    listheader.Type7 = "";
                }
                if (listheader.Type8 == null)
                {
                    listheader.Type8 = "";
                }
                if (listheader.Type9 == null)
                {
                    listheader.Type9 = "";
                }
                if (listheader.Type10 == null)
                {
                    listheader.Type10 = "";
                }

                // if (listheader.FieldName1 == null) { listheader.FieldName1 = ""; }
                if (listheader.FieldName2 == null)
                {
                    listheader.FieldName2 = "";
                }
                if (listheader.FieldName3 == null)
                {
                    listheader.FieldName3 = "";
                }
                if (listheader.FieldName4 == null)
                {
                    listheader.FieldName4 = "";
                }
                if (listheader.FieldName5 == null)
                {
                    listheader.FieldName5 = "";
                }
                if (listheader.FieldName6 == null)
                {
                    listheader.FieldName6 = "";
                }
                if (listheader.FieldName7 == null)
                {
                    listheader.FieldName7 = "";
                }
                if (listheader.FieldName8 == null)
                {
                    listheader.FieldName8 = "";
                }
                if (listheader.FieldName9 == null)
                {
                    listheader.FieldName9 = "";
                }
                if (listheader.FieldName10 == null)
                {
                    listheader.FieldName10 = "";
                }

                if (ModelState.IsValid)
                {
                    db.Entry(listheader).State = EntityState.Modified;
                    db.SaveChanges();
                    TempData["Message2"] = string.Format("List header update successfully.");
                    GetData();
                    return(RedirectToAction("Create", "ListItem", new { ListTableID = listheader.ListTableID }));
                }
            }
            catch (Exception ex)
            {
                TempData["Message2"] = string.Format("Error editing table header.");
            }
            GetData();
            return(PartialView(listheader));
        }
Example #15
0
        public ActionResult Edit(int ListHeaderID)
        {
            listheader listheader = ListHeaderRepository.GetListHeaderByID(ListHeaderID);

            return(PartialView(listheader));
        }