Пример #1
0
        public ActionResult Create(TripEndModel model)
        {
            ViewBag.Head = "Manage End Trip";
            ViewBag.Form = "End Trips Registration";

            model.TripReferenceID = ProcedureNameHandling.TripReference;
            if (model.EndDate <= DateTime.Now.Date)
            {
                if (ModelState.IsValid)
                {
                    model.EntryUser = Convert.ToInt32(Session["UserCode"].ToString());
                    try
                    {
                        _rep.Create(model);
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
                else
                {
                    return(View(model));
                }
            }
            else
            {
                return(View(model));
            }
        }
Пример #2
0
        public ActionResult DeleteItem(int id, TripEndModel mod)
        {
            ViewBag.Head = "Manage End Trip";
            ViewBag.Form = "End Trips Registration";

            mod.TripExpenceList.RemoveAt(id);

            return(View("Create", mod));
        }
Пример #3
0
        public ActionResult Create(int id)
        {
            ViewBag.Head = "Manage End Trip";
            ViewBag.Form = "End Trips Registration";

            TripEndModel model = new TripEndModel();

            ProcedureNameHandling.TripBeginList = _repBegin.GetList(id).ToList();
            model.TripBeginList = ProcedureNameHandling.TripBeginList;
            ProcedureNameHandling.TripReference = id;
            ProcedureNameHandling.list          = _rep.GetExpenceList().ToList();

            return(View(model));
        }
Пример #4
0
        public ActionResult AddRow(TripEndModel oldModel, string ExpenceNameValue, decimal AmountValue, string CommentsValue)
        {
            ViewBag.Head = "Manage End Trip";
            ViewBag.Form = "End Trips Registration";
            TripExpenceViewModel model = new TripExpenceViewModel();

            model.ExpenceName   = ExpenceNameValue;
            model.Amount        = AmountValue;
            model.Comments      = CommentsValue;
            model.ExpenceNameID = ProcedureNameHandling.list.Where(x => x.ExpenceName.Contains(ExpenceNameValue)).Select(y => y.ExpenceNameID).First();
            oldModel.TripExpenceList.Add(model);
            ExpenceNameValue       = "";
            AmountValue            = 0;
            CommentsValue          = "";
            oldModel.TripBeginList = ProcedureNameHandling.TripBeginList;
            return(View("Create", oldModel));
        }