public ActionResult Detail(int?id) { if (!id.HasValue) { return(HttpNotFound()); } var reversalData = _reversalBll.GetById(id.Value); if (reversalData == null) { return(HttpNotFound()); } var model = new ReversalIndexViewModel(); try { model.Details = Mapper.Map <DataReversal>(reversalData); model = InitialModel(model); } catch (Exception exception) { AddMessageInfo(exception.Message, Enums.MessageInfoType.Error); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Edit(int?id) { if (!id.HasValue) { return(HttpNotFound()); } var reversalData = _reversalBll.GetById(id.Value); if (reversalData == null) { return(HttpNotFound()); } var model = new ReversalIndexViewModel(); if (CurrentUser.UserRole == Enums.UserRole.Viewer || CurrentUser.UserRole == Enums.UserRole.Controller) { return(RedirectToAction("Detail", new { id })); } try { model.Details = Mapper.Map <DataReversal>(reversalData); model = InitialModel(model); } catch (Exception exception) { AddMessageInfo(exception.Message, Enums.MessageInfoType.Error); return(RedirectToAction("Index")); } return(View(model)); }
public JsonResult GetInventoryMovementData(string plantWerk, string faCode) { var listInventoryMovement = GlobalFunctions.GetReversalInventoryMovementData(plantWerk, faCode); var model = new ReversalIndexViewModel() { InventoryMovementList = listInventoryMovement }; return(Json(model)); }
public JsonResult GetZaapData(string plantWerk, string faCode) { var listZaap = GlobalFunctions.GetReversalData(plantWerk, faCode); var model = new ReversalIndexViewModel() { ZaapShiftList = listZaap }; return(Json(model)); }
public JsonResult GetFaCodeByPlant(string plantWerk) { var listBrandCe = GlobalFunctions.GetFaCodeByPlant(plantWerk); var model = new ReversalIndexViewModel() { FaCodeList = listBrandCe }; return(Json(model)); }
public ActionResult Create() { if (CurrentUser.UserRole == Enums.UserRole.Controller || CurrentUser.UserRole == Enums.UserRole.Viewer || CurrentUser.UserRole == Enums.UserRole.Administrator) { AddMessageInfo("Operation not allow", Enums.MessageInfoType.Error); return(RedirectToAction("Index")); } var model = new ReversalIndexViewModel { MainMenu = _mainMenu, CurrentMenu = PageInfo, Details = new DataReversal() }; return(CreateInitial(model)); }
private ReversalIndexViewModel InitIndexViewModel( ReversalIndexViewModel model) { var listPlant = GlobalFunctions.GetPlantAll(); if (CurrentUser.UserRole != Enums.UserRole.Administrator) { var itemPlant = GlobalFunctions.GetPlantAll().Where(x => CurrentUser.ListUserPlants.Contains(x.Value)); listPlant = new SelectList(itemPlant, "Value", "Text"); } model.PlantWerksList = listPlant; model.Detail = GetListDocument(model); return(model); }
private List <DataReversal> GetListDocument(ReversalIndexViewModel filter = null) { if (filter == null) { //Get All var reversalData = _reversalBll.GetListDocumentByParam(new ReversalGetByParamInput()).OrderByDescending(d => d.ProductionDate); return(Mapper.Map <List <DataReversal> >(reversalData)); } //getbyparams var input = Mapper.Map <ReversalGetByParamInput>(filter); input.UserId = CurrentUser.USER_ID; input.UserRole = CurrentUser.UserRole; input.ListUserPlants = CurrentUser.ListUserPlants; var dbData = _reversalBll.GetListDocumentByParam(input).OrderByDescending(c => c.ProductionDate); return(Mapper.Map <List <DataReversal> >(dbData)); }
private ReversalIndexViewModel InitialModel(ReversalIndexViewModel model) { var plantList = GlobalFunctions.GetPlantAll(); if (CurrentUser.UserRole != Enums.UserRole.Administrator) { var distinctPlant = plantList.Where(x => CurrentUser.ListUserPlants.Contains(x.Value)); var getPlant = new SelectList(distinctPlant, "Value", "Text"); plantList = getPlant; } model.MainMenu = _mainMenu; model.CurrentMenu = PageInfo; model.PlantWerksList = plantList; model.FaCodeList = GlobalFunctions.GetFaCodeByPlant(model.Details.Werks); model.ZaapShiftList = GlobalFunctions.GetReversalData("", ""); model.InventoryMovementList = GlobalFunctions.GetReversalInventoryMovementData("", ""); return(model); }
public PartialViewResult FilterListData(ReversalIndexViewModel model) { model.Detail = GetListDocument(model); model.IsNotViewer = (CurrentUser.UserRole != Enums.UserRole.Controller && CurrentUser.UserRole != Enums.UserRole.Viewer ? true : false); return(PartialView("_ReversalList", model)); }
public ActionResult Edit(ReversalIndexViewModel model) { try { ReversalDto item = new ReversalDto(); item = Mapper.Map <ReversalDto>(model.Details); var createInput = Mapper.Map <ReversalCreateParamInput>(model.Details); //var param = new MonthClosingGetByParam(); //param.ClosingDate = item.ProductionDate; //param.PlantId = item.Werks; //param.DisplayDate = null; //var monthClosingdata = _monthClosingBll.GetDataByParam(param); //if (monthClosingdata != null) //{ // AddMessageInfo("Please check closing date.", Enums.MessageInfoType.Warning); // model = InitialModel(model); // return View(model); //} var checkData = _reversalBll.CheckData(createInput); if (checkData.IsForCk4cCompleted) { AddMessageInfo("Can't create reversal data for ck4c completed", Enums.MessageInfoType.Info); model = InitialModel(model); return(View(model)); } if (checkData.IsPackedQtyNotExists) { AddMessageInfo("Can't create reversal data, no packed qty", Enums.MessageInfoType.Info); model = InitialModel(model); return(View(model)); } if (checkData.IsMoreThanQuota) { AddMessageInfo("Can't create reversal data, quota exceed", Enums.MessageInfoType.Info); model = InitialModel(model); return(View(model)); } if (checkData.IsMoreThanPacked) { AddMessageInfo("Can't create reversal data, reversal more than packed", Enums.MessageInfoType.Info); model = InitialModel(model); return(View(model)); } var reversalData = _reversalBll.Save(item, CurrentUser.USER_ID); AddMessageInfo("Save Successfully", Enums.MessageInfoType.Success); return(RedirectToAction("Edit", new { id = model.Details.ReversalId })); } catch (Exception exception) { AddMessageInfo(exception.Message, Enums.MessageInfoType.Error); model = InitialModel(model); return(View(model)); } }
public ActionResult CreateInitial(ReversalIndexViewModel model) { return(View("Create", InitialModel(model))); }