public ActionResult RequestQuestionGVP(int Id) { var model = new List <RequestQuestionSenarioViewModel>(); if (Id != 0) { model = RequestQuestionSenarioViewModel.GetRequestQuestionSenarioListByRegisterRequests_Id(Id); } ViewBag.Id = Id; RegisterRequestsDAL RR = new RegisterRequestsDAL(Id); ViewBag.Status = RR.RegisterRequests.RequestStatus.GetValueOrDefault(); return(PartialView("_RequestQuestionGVP", model)); }
public ActionResult QA(int Id) { var model = new List <RequestQuestionSenarioViewModel>(); if (Id != 0) { model = RequestQuestionSenarioViewModel.GetRequestQuestionSenarioListByRegisterRequests_Id(Id); } ViewBag.Id = Id; RegisterRequestsDAL RR = new RegisterRequestsDAL(Id); ViewBag.Status = RR.RegisterRequests.RequestStatus.GetValueOrDefault(); ViewBag.QA = model; ViewBag.ReturnUrl = "RegisterRequest/QA/" + Id; return(View()); }
public ActionResult QA() { int Id = int.Parse(Request.Params["Id"]); var model = new List <RequestQuestionSenarioViewModel>(); if (Id != 0) { model = RequestQuestionSenarioViewModel.GetRequestQuestionSenarioListByRegisterRequests_Id(Id); } foreach (var Q in model) { var Answers = Request.Params["Answers_" + Q.Id]; RequestQuestionSenarioDAL RQS = new RequestQuestionSenarioDAL(Q.Id); RQS.RequestQuestionSenario.Answers = Answers; RQS.Update(); } RegisterRequestsDAL rrDAL = new RegisterRequestsDAL(Id); rrDAL.RegisterRequests.RequestStatus = 2; rrDAL.Update(); ViewBag.ReturnUrl = "RegisterRequest/QA/" + Id; return(View()); }
public ActionResult RequestQuestionGVPUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] MVCxGridViewBatchUpdateValues <RequestQuestionSenarioViewModel, int> updateValues, int Id) { ViewBag.Id = Id; RegisterRequestsDAL RR = new RegisterRequestsDAL(Id); ViewBag.Status = RR.RegisterRequests.RequestStatus.GetValueOrDefault(); var model = RequestQuestionSenarioViewModel.GetRequestQuestionSenarioListByRegisterRequests_Id(Id); // Insert all added values. var newId = model.Count > 0 ? model.Max(i => i.Id) : 0; foreach (var item in updateValues.Insert) { try { RequestQuestionSenarioViewModel RQS = new RequestQuestionSenarioViewModel(); RQS.Question_id = item.Question_id; RQS.RegisterRequests_Id = Id; RQS.Create(); model.Add(RQS); } catch (Exception e) { updateValues.SetErrorText(item, e.Message); } } // Update all edited values. foreach (var item in updateValues.Update) { try { var modelItem = model.FirstOrDefault(it => it.Id == item.Id); if (modelItem != null) { item.Update(); } } catch (Exception e) { updateValues.SetErrorText(item, e.Message); } } // Delete all values that were deleted on the client side from the data source. foreach (var ItemID in updateValues.DeleteKeys) { try { var item = model.FirstOrDefault(it => it.Id == Convert.ToInt32(ItemID)); if (item != null) { item.Delete(); } } catch (Exception e) { updateValues.SetErrorText(ItemID, e.Message); } } return(PartialView("_RequestQuestionGVP", model)); }