public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] ApprovalLevel approvalLevel) { if (id != approvalLevel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(approvalLevel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ApprovalLevelExists(approvalLevel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(approvalLevel)); }
protected void dgApprovalLevel_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "AddNew") { try { ApprovalLevel approvallevel = new ApprovalLevel(); DropDownList ddlFPositionName = e.Item.FindControl("ddlFPosition") as DropDownList; approvallevel.EmployeePosition = _presenter.GetEmployeePosition(Convert.ToInt32(ddlFPositionName.SelectedValue)); DropDownList ddlFWill = e.Item.FindControl("ddlFWill") as DropDownList; approvallevel.Will = ddlFWill.SelectedValue; approvallevel.WorkflowLevel = _presenter.CurrentApprovalSetting.GetApprovalLevelCount() + 1; approvallevel.ApprovalSetting = _approvalsetting; _presenter.CurrentApprovalSetting.ApprovalLevels.Add(approvallevel); Master.ShowMessage(new AppMessage("Approval Level added successfully.", RMessageType.Info)); dgApprovalLevel.EditItemIndex = -1; BindApprovalLevels(); } catch (Exception ex) { Master.ShowMessage(new AppMessage("Error: Unable to Add Approval Level. " + ex.Message, RMessageType.Error)); } } }
public Expense(DateTime date, Category category, string descrition, decimal amount, bool approvalStatus, ApprovalLevel approvalLevel) { Date = date; Category = category; Description = descrition; Amount = amount; ApprovalStatus = approvalStatus; ApprovalLevel = approvalLevel; }
public void UpdateInterface(float desire, ApprovalLevel dad, ApprovalLevel craig, float happiness, int week) { desireBar.value = desire; happinessBar.value = happiness; //Change the sprites based on the Approval Level dadApproval.sprite = ChangeApprovalFace(dad); craigApproval.sprite = ChangeApprovalFace(craig); weekText.text = "Week " + week; }
public async Task <IActionResult> Create([Bind("Id,Name")] ApprovalLevel approvalLevel) { if (ModelState.IsValid) { _context.Add(approvalLevel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(approvalLevel)); }
private Sprite ChangeApprovalFace(ApprovalLevel lvl) { switch (lvl) { case ApprovalLevel.Happy: return(approvalHappy); case ApprovalLevel.Neutral: return(approvalNeutral); case ApprovalLevel.Angry: return(approvalAngry); } //We should never get here return(approvalNeutral); }
private CardAccess CreateCardAccess(ApprovalLevel approvalLevel, string employeeId, string cardId, string doorId, string note, string timeZoneId) { var res = Db.CardAccesses.FirstOrDefault(ca => ca.CardId == cardId && ca.DoorId == doorId && ca.ApprovalLevel == approvalLevel && ca.ApprovalStatus == ApprovalStatus.WaitingForApproval && ca.AssignmentType == AssignmentType.Special && ca.TimeZoneId == timeZoneId ) ?? new CardAccess { CardId = cardId, DoorId = doorId, ApprovalLevel = approvalLevel, ApprovalStatus = ApprovalStatus.WaitingForApproval, AssignmentType = AssignmentType.Special, TimeZoneId = timeZoneId }; res.Note = note; res.ApprovedDate = null; res.OriginApproverId = employeeId; /* * var accessor = Db.Employees.Find(employeeId); * if (accessor != null * && accessor.DelegateToId != null * && (accessor.DelegateFromDate ?? DateTime.MinValue) <= DateTime.Now * && (accessor.DelegateToDate ?? DateTime.MaxValue) >= DateTime.Now) * { * res.ApprovedById = accessor.DelegateToId; * } * else * { * res.ApprovedById = employeeId; * } */ res.ApprovedById = employeeId; if (res.Id == null) { Db.CardAccesses.Add(res); } return(res); }
// metodo che crea una spesa a partire da una riga del file // -- analizza il contenuto della riga // -- definisce approval level sulla base dell'importo // -- definisce approval status sulla base di approval level // -- restituisce una Expense public static Expense CreateExpenseFromFile(string line) { // manipolazione della riga e sua analisi string[] values = line.Split(";"); DateTime date = new DateTime(2020, 02, 02); // valore arbitrario if (DateTime.TryParse(values[0], out DateTime d)) { date = d; } Category category = Category.Other; // valore arbitrario if (Category.TryParse(values[1], out Category c)) { category = c; } string description = values[2]; decimal amount = 0; // valore arbitrario if (decimal.TryParse(values[3], out decimal a)) { amount = a; } var manager = SetExpenseChain(); // primo elemento della catena ApprovalLevel approvalLevel = manager.Handle(amount); bool approvalStatus = false; if (approvalLevel != ApprovalLevel.None) { approvalStatus = true; } // **************** qui avrei dovuto creare solo se approvalLevel era true ******************** // creazione di una Expense return(new Expense(date, category, description, amount, approvalStatus, approvalLevel)); }
protected void dgApprovalLevel_UpdateCommand1(object source, DataGridCommandEventArgs e) { int id = (int)dgApprovalLevel.DataKeys[e.Item.ItemIndex]; ApprovalLevel approvalLevel = _presenter.CurrentApprovalSetting.GetApprovalLevel(id); try { DropDownList ddlPositionName = e.Item.FindControl("ddlPosition") as DropDownList; approvalLevel.EmployeePosition = _presenter.GetEmployeePosition(Convert.ToInt32(ddlPositionName.SelectedValue)); DropDownList ddlWill = e.Item.FindControl("ddlWill") as DropDownList; approvalLevel.Will = ddlWill.SelectedValue; // approvalLevel.ApprovalSetting = _approvalsetting; _presenter.SaveOrUpdateApprovalSetting(_presenter.CurrentApprovalSetting); Master.ShowMessage(new AppMessage("Approval Level Updated successfully.", Chai.WorkflowManagment.Enums.RMessageType.Info)); dgApprovalLevel.EditItemIndex = -1; BindApprovalLevels(); } catch (Exception ex) { Master.ShowMessage(new AppMessage("Error: Unable to Update Approval Level Detail. " + ex.Message, Chai.WorkflowManagment.Enums.RMessageType.Error)); } }
public void DeleteApprovalLevel(ApprovalLevel approvallevel) { _controller.DeleteEntity(approvallevel); }