Exemple #1
0
        public ActionResult CreateItem()
        {
            ItemCategory itmCatg = new ItemCategory();
            ItemType     itmTy   = new ItemType();
            ItemStatus   itmSts  = new ItemStatus();
            ItemPriority itmPry  = new ItemPriority();

            ViewBag.CategoryVB     = new SelectList(itmCatg.GetItemCategories(), "CategoryId", "CategoryName");
            ViewBag.ItemTypeVB     = new SelectList(itmTy.GetItemTypes(), "ItemTypeId", "ItemName");
            ViewBag.ItemStatusVB   = new SelectList(itmSts.GetItemStatus(), "ItemStatusId", "ItemStatusName");
            ViewBag.ItemPriorityVB = new SelectList(itmPry.GetItemPriority(), "PriorityId", "PriorityName");

            return(View());
        }
Exemple #2
0
        public ActionResult Edit(int ID)
        {
            // To be Loaded in Edit form
            ItemCategory itmCatg = new ItemCategory();
            ItemType     itmTy   = new ItemType();
            ItemStatus   itmSts  = new ItemStatus();
            ItemPriority itmPry  = new ItemPriority();

            TrackerItem itmObj = new TrackerItem();
            var         item   = itmObj.GetById(ID);

            ViewBag.CategoryVB     = new SelectList(itmCatg.GetItemCategories(), "CategoryId", "CategoryName", item.ItemCategory);
            ViewBag.ItemTypeVB     = new SelectList(itmTy.GetItemTypes(), "ItemTypeId", "ItemName", item.ItemType);
            ViewBag.ItemStatusVB   = new SelectList(itmSts.GetItemStatus(), "ItemStatusId", "ItemStatusName", item.ItemStatus);
            ViewBag.ItemPriorityVB = new SelectList(itmPry.GetItemPriority(), "PriorityId", "PriorityName", item.ItemPriority);


            return(View(item));
        }
Exemple #3
0
        public ActionResult CreateItem(TrackerItem itm, HttpPostedFileBase file)
        {
            //var ItemCategory = frm["ItemCategory"];
            // var CategoryId = frm["CategoryId"];
            //var ItemTypeId = frm["ItemType"];
            //var Priority = frm["Priority"];

            //var ItemCreatedDate = frm["ItemCreatedDate"];
            //var CreatedBy = frm["CreatedBy"];
            //var Owner = frm["Owner"];
            //var Imapct = frm["Imapct"];
            //var Resolution = frm["Resolution"];
            //var Resolved =frm["Resolved"];

            var fileName = String.Empty;

            if (ValidateForm(itm))
            {
                //File Validation
                if (file != null && file.ContentLength > 0)
                {
                    fileName = Path.GetFileName(file.FileName);
                    var path = Path.Combine(Server.MapPath("~/Content/upload_attachements"), fileName);
                    file.SaveAs(path);
                }

                // After data validation Success
                TrackerItem ti = new TrackerItem();
                ti.ItemId = itm.ItemId;

                ti.ProjectName = itm.ProjectName;
                ti.ItemSummary = itm.ItemSummary;


                ti.ItemCategory = itm.ItemCategory;
                ti.ItemPriority = itm.ItemPriority;

                ti.ItemType        = itm.ItemType;
                ti.ItemStatus      = itm.ItemStatus;
                ti.ItemSummary     = itm.ItemSummary;
                ti.CreatedBy       = itm.CreatedBy;
                ti.ItemCreatedDate = itm.ItemCreatedDate;
                ti.ParentId        = itm.ParentId;
                ti.AssignedTo      = itm.AssignedTo;
                ti.AssignedDate    = itm.AssignedDate;
                ti.ItemEndDate     = itm.ItemEndDate;
                ti.Owner           = itm.Owner;
                ti.WorkCompleted   = itm.WorkCompleted;
                ti.ResolvedDate    = itm.ResolvedDate;
                ti.Impact          = itm.Impact;
                ti.Resolution      = itm.Resolution;
                ti.AttachmentPath  = fileName;

                ti.Add(ti);

                //Add button Valid True
                if (ModelState.IsValid)
                {
                    ViewBag.Message = "Item has created successfully.";
                    return(RedirectToAction("ItemsList", "Home"));
                }

                //ViewBag.Message = "Item has created successfully.";
                //RedirectToAction("ItemsList","Home");
            }
            else
            {
                //Error
                ViewBag.Message = "There are errors in creating Item.";
            }


            ItemCategory itmCatg = new ItemCategory();
            ItemType     itmTy   = new ItemType();
            ItemStatus   itmSts  = new ItemStatus();
            ItemPriority itmPry  = new ItemPriority();

            ViewBag.CategoryVB     = new SelectList(itmCatg.GetItemCategories(), "CategoryId", "CategoryName");
            ViewBag.ItemTypeVB     = new SelectList(itmTy.GetItemTypes(), "ItemTypeId", "ItemName");
            ViewBag.ItemStatusVB   = new SelectList(itmSts.GetItemStatus(), "ItemStatusId", "ItemStatusName");
            ViewBag.ItemPriorityVB = new SelectList(itmPry.GetItemPriority(), "PriorityId", "PriorityName");
            return(View());
        }