public ActionResult MoneyAccountEmployee_Delete(MoneyAccountEmployeeView moneyAccountEmployeeView) { MoneyAccountEmployeeDetailView moneyAccountEmployeeDetailView = new MoneyAccountEmployeeDetailView(); GeneralResponse response = new GeneralResponse(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccountEmployee_Delete"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountEmployeeDetailView)); } #endregion response = this._moneyAccountEmployeeService.DeleteMoneyAccountEmployee(moneyAccountEmployeeView.MoneyAccountID, moneyAccountEmployeeView.EmployeeID); if (!response.success) { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("", error); } } return(View(moneyAccountEmployeeDetailView)); }
public ActionResult Edit(string id, MoneyAccountEmployeeDetailView moneyAccountEmployeeDetailView) { moneyAccountEmployeeDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccountEmployee_Update"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountEmployeeDetailView)); } #endregion if (ModelState.IsValid) { try { EditMoneyAccountEmployeeRequest request = new EditMoneyAccountEmployeeRequest(); request.ID = Guid.Parse(id); request.ModifiedEmployeeID = GetEmployee().ID; request.EmployeeID = moneyAccountEmployeeDetailView.MoneyAccountEmployeeView.EmployeeID; request.MoneyAccountID = moneyAccountEmployeeDetailView.MoneyAccountEmployeeView.MoneyAccountID; request.RowVersion = moneyAccountEmployeeDetailView.MoneyAccountEmployeeView.RowVersion; GeneralResponse response = this._moneyAccountEmployeeService.EditMoneyAccountEmployee(request); if (response.success) { return(RedirectToAction("Index")); } else { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("", error); } return(View(moneyAccountEmployeeDetailView)); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(moneyAccountEmployeeDetailView)); } } return(View(moneyAccountEmployeeDetailView)); }
public ActionResult Create() { MoneyAccountEmployeeDetailView moneyAccountEmployeeDetailView = new MoneyAccountEmployeeDetailView(); moneyAccountEmployeeDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccountEmployee_Insert"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountEmployeeDetailView)); } #endregion return(View(moneyAccountEmployeeDetailView)); }
public ActionResult Delete(string id) { MoneyAccountEmployeeDetailView moneyAccountEmployeeDetailView = new MoneyAccountEmployeeDetailView(); moneyAccountEmployeeDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccountEmployee_Delete"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountEmployeeDetailView)); } #endregion moneyAccountEmployeeDetailView.MoneyAccountEmployeeView = this.GetMoneyAccountEmployeeView(id); return(View(moneyAccountEmployeeDetailView)); }
public ActionResult MoneyAccountEmployee(string id) { MoneyAccountEmployeeDetailView moneyAccountEmployeeDetailView = new MoneyAccountEmployeeDetailView(); moneyAccountEmployeeDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccountEmployee_Read"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountEmployeeDetailView)); } #endregion moneyAccountEmployeeDetailView.MoneyAccountView = GetMoneyAccountView(id); moneyAccountEmployeeDetailView.MoneyAccountEmployeeViews = _moneyAccountEmployeeService.GetMoneyAccountEmployees(Guid.Parse(id)).MoneyAccountEmployeeViews; #region DropDownList For Employees moneyAccountEmployeeDetailView.EmployeeViews = _employeeService.GetEmployees().EmployeeViews; List <DropDownItem> list = new List <DropDownItem>(); if (moneyAccountEmployeeDetailView.EmployeeViews.Count() > 0) { foreach (EmployeeView employeeView in moneyAccountEmployeeDetailView.EmployeeViews) { list.Add(new DropDownItem { Value = employeeView.ID.ToString(), Text = employeeView.Name }); } } var selectList = new SelectList(list, "Value", "Text"); ViewData["Employees"] = selectList; #endregion return(View(moneyAccountEmployeeDetailView)); }
public ActionResult Delete(string id, FormCollection collection) { MoneyAccountEmployeeDetailView moneyAccountEmployeeDetailView = new MoneyAccountEmployeeDetailView(); moneyAccountEmployeeDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccountEmployee_Delete"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountEmployeeDetailView)); } #endregion moneyAccountEmployeeDetailView.MoneyAccountEmployeeView = this.GetMoneyAccountEmployeeView(id); DeleteRequest request = new DeleteRequest() { ID = Guid.Parse(id) }; GeneralResponse response = this._moneyAccountEmployeeService.DeleteMoneyAccountEmployee(request); if (response.success) { return(RedirectToAction("Index")); } else { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("", error); } return(View(moneyAccountEmployeeDetailView)); } }
public ActionResult MoneyAccountEmployee(string id, MoneyAccountEmployeeDetailView moneyAccountEmployeeDetailView) { moneyAccountEmployeeDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccountEmployee_Read"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountEmployeeDetailView)); } #endregion moneyAccountEmployeeDetailView.MoneyAccountEmployeeViews = _moneyAccountEmployeeService.GetMoneyAccountEmployees(Guid.Parse(id)).MoneyAccountEmployeeViews; moneyAccountEmployeeDetailView.MoneyAccountView = _moneyAccountService.GetMoneyAccount(new GetRequest() { ID = Guid.Parse(id) }).MoneyAccountView; #region DropDownList For Employees moneyAccountEmployeeDetailView.EmployeeViews = _employeeService.GetEmployees().EmployeeViews; List <DropDownItem> list = new List <DropDownItem>(); if (moneyAccountEmployeeDetailView.EmployeeViews.Count() > 0) { foreach (EmployeeView employeeView in moneyAccountEmployeeDetailView.EmployeeViews) { list.Add(new DropDownItem { Value = employeeView.ID.ToString(), Text = employeeView.Name }); } } var selectList = new SelectList(list, "Value", "Text"); ViewData["Employees"] = selectList; #endregion if (ModelState.IsValid) { try { AddMoneyAccountEmployeeRequestOld request = new AddMoneyAccountEmployeeRequestOld(); request.MoneyAccountID = Guid.Parse(id); request.CreateEmployeeID = GetEmployee().ID; request.EmployeeID = moneyAccountEmployeeDetailView.EmployeeViewForInsert.ID; GeneralResponse response = _moneyAccountEmployeeService.AddMoneyAccountEmployee(request); if (!response.success) { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("", error); } return(View(moneyAccountEmployeeDetailView)); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(moneyAccountEmployeeDetailView)); } } // Reload content of grid: moneyAccountEmployeeDetailView.MoneyAccountEmployeeViews = _moneyAccountEmployeeService.GetMoneyAccountEmployees(Guid.Parse(id)).MoneyAccountEmployeeViews; return(View(moneyAccountEmployeeDetailView)); }