// GET: TestAPI public async Task <ActionResult> GetDeduction() { WebClient client = new WebClient(); Deduction deduction = await client.GetDeduction(); return(View(deduction)); }
public void SimpleTest(double first, double second, double expected) { Deduction calc = new Deduction(); double result = calc.Action(first, second); Assert.AreEqual(expected, result); }
public JsonResult CreateDeduction(string deduction) { try { if (ModelState.IsValid) { Deduction deductionObj = JsonConvert.DeserializeObject <Deduction>(deduction); deductionObj.CreatedBy = "admin"; deductionObj.CreatedDate = DateTime.Now; deductionObj.LastUpdBy = "admin"; deductionObj.LastUpdDate = DateTime.Now; deductionObj.CompanyId = "ABC"; // TODO: Add update logic here //_context.Update(user); _context.Add(deductionObj); _context.SaveChanges(); } return(Json(new { Success = true })); } catch { throw; } }
public IHttpActionResult PutDeduction(int id, Deduction deduction) { if (id != deduction.EmployeeId) { return(BadRequest()); } db.Entry(deduction).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DeductionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void button1_Click_1(object sender, EventArgs e) { Deduction objDeductions = new Deduction(); //objDeductions.MdiParent = this; objDeductions.Show(); }
public async Task <JsonResult> EditDeduction(string deduction) { try { if (ModelState.IsValid) { Deduction deductionEntity = JsonConvert.DeserializeObject <Deduction>(deduction); var incomeToUpdate = _context.Deduction.Where(u => u.DeductionId == deductionEntity.DeductionId).FirstOrDefault(); incomeToUpdate.TranDate = deductionEntity.TranDate; incomeToUpdate.DedAmount = deductionEntity.DedAmount; incomeToUpdate.RecurStart = deductionEntity.RecurStart; incomeToUpdate.RecurEnd = deductionEntity.RecurEnd; incomeToUpdate.Frequency = deductionEntity.Frequency; _context.Entry(incomeToUpdate).State = EntityState.Modified; //_context.Entry(loanToUpdate).CurrentValues.SetValues(loanObj); // TODO: Add update logic here await _context.SaveChangesAsync(); } return(Json(new { Success = true })); } catch { throw; } }
private void btnOk_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; if (string.IsNullOrEmpty(txtIdNum.Text)) { MessageDialog.Show("Invalid Deduction Code", "You have entered an Invalid Code"); txtIdNum.SelectAll(); return; } ; var deduction = new DeductionDataReader().GetItem(txtIdNum.Text); if (deduction == null) { MessageDialog.Show("Invalid Deduction Code", "You have entered an Invalid Code"); txtIdNum.SelectAll(); return; } ItemData = deduction; DialogResult = DialogResult.OK; }
private void Save_Click(object sender, RoutedEventArgs e) { if (comboBoxEmplyees.SelectedIndex == -1) { MessageBox.Show("يجب اختيار موظف"); return; } Emplyee emp = emplyeeList[comboBoxEmplyees.SelectedIndex]; if (int.TryParse(textBoxPrice.Text, out int price)) { Deduction deduction = new Deduction() { DeductionValue = price, Reson = textBoxDetails.Text, Date = pickerStartDate.SelectedDate ?? DateTime.Now, Emplyee_Name = emp.Name, Emplyee_Id = emp.Id, Notes = textBoxNotes.Text }; emplyeeData.AddDeduction(deduction); MessageBox.Show("تم الحفظ"); } else { MessageBox.Show("تاكد من قيمة الخصم \\ السلفة"); } }
public ActionResult Create(DeductionViewModels collection) { try { if (ModelState.IsValid) { Deduction toDB = new Deduction(); toDB.Active = 1; toDB.DeductionDescription = collection.DeductionDescription; toDB.DeductionName = collection.DeductionName; //toDB.DeductionValue = collection.DeductionValue; toDB.Order = collection.Order; deductionBL.InsertDeduction(toDB); return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Error."); return(View(collection)); } } catch { ModelState.AddModelError("", "Error."); return(View(collection)); } }
public SalaryPaymentHistory ContributionsOrDeductions(SalaryPaymentHistory model) { int theStaffID = model.StaffID; PrimarySchoolStaff theStaff = work.PrimarySchoolStaffRepository.Get(a => a.UserID == theStaffID).First(); //get deductions out String[] theContributionId;// = new StringBuilder(); List <Deduction> theDeductiong = new List <Deduction>(); if (!(string.IsNullOrEmpty(theStaff.ContributionIDs))) { theContributionId = theStaff.ContributionIDs.Split(' '); foreach (var c in theContributionId) { if (!(string.IsNullOrEmpty(c))) { int theContributionID = Convert.ToInt16(c); Deduction thed = work.DeductionRepository.GetByID(theContributionID); if (thed != null) { theDeductiong.Add(thed); } } } } model.TheDeduction = theDeductiong; return(model); }
public void default_payment_for_deduction_is_the_amortized_amount() { var d = Deduction.Create(salary, 3, MonetaryValue.of("php", 1000)); var p = DeductionPayment.Create(d); Assert.Equal(d.AmortizedAmount.DecimalValue(), p.PaidAmount.DecimalValue()); }
public ActionResult Edit(DeductionViewModels viewModel) { try { if (ModelState.IsValid) { int active = 0; if (viewModel.Active) { active = 1; } Deduction toDB = new Deduction(); toDB.Active = active; toDB.DeductionDescription = viewModel.DeductionDescription; toDB.DeductionName = viewModel.DeductionName; //toDB.DeductionValue = viewModel.DeductionValue; toDB.DeductionId = viewModel.DeductionId; toDB.Order = viewModel.Order; deductionBL.UpdateDeduction(toDB); return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Error."); return(View(viewModel)); } } catch { ModelState.AddModelError("", "Error."); return(View(viewModel)); } }
public EmployeeSearch(Deduction frmObj, String strDiv, String frmtype) { frmDeduction = frmObj; strDivision = strDiv; strFrmType = frmtype; InitializeComponent(); }
public IHttpActionResult PostDeduction(Deduction deduction) { db.Deductions.Add(deduction); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = deduction.EmployeeId }, deduction)); }
public IActionResult Create([FromBody] Deduction Deduction) { if (Authorize()) { if (Deduction == null) { return(BadRequest()); } var dbDeduction = _context.Deductions.FirstOrDefault(t => t.DeductionCode == Deduction.DeductionCode); if (dbDeduction == null) { _context.Deductions.Add(Deduction); _context.SaveChanges(); return(StatusCode(200)); } else { return(StatusCode(409)); } } else { return(StatusCode(403)); } }
public int AddDeduction(Deduction deduction) { int result = -1; using (SQLiteConnection conn = new SQLiteConnection(sQLiteConnection)) { conn.Open(); using (SQLiteCommand cmd = new SQLiteCommand(conn)) { cmd.CommandText = "INSERT INTO TA_Deduction(Emplyee_Name, Emplyee_Id, DeductionValue, Date, Reson, Notes) VALUES (@Emplyee_Name, @Emplyee_Id, @Deduction, @Date, @Reson, @Notes)"; cmd.Prepare(); cmd.Parameters.AddWithValue("@Emplyee_Name", deduction.Emplyee_Name); cmd.Parameters.AddWithValue("@Emplyee_Id", deduction.Emplyee_Id); cmd.Parameters.AddWithValue("@Deduction", deduction.DeductionValue); cmd.Parameters.AddWithValue("@Date", deduction.Date); cmd.Parameters.AddWithValue("@Reson", deduction.Reson); cmd.Parameters.AddWithValue("@Notes", deduction.Notes); try { result = cmd.ExecuteNonQuery(); } catch (SQLiteException e) { } } conn.Close(); } return(result); }
public void InsertDeduction(Deduction deduction) { using (var db = new PayrollEntities()) { db.Deductions.Add(deduction); db.SaveChanges(); } }
public virtual ActionResult CreateDeductions(Deduction model) { model.IsCustomizable = true; _deductionRepository.Add(model); _unitOfWork.Commit(); return(RedirectToAction("Deductions")); }
/// <summary> /// Calculates the hashcode of the current Implication by combining the hashcodes of /// its atoms, both in query and deduction. /// If the label is present, it becomes the main identifier of the Implication. /// </summary> /// <returns>The hashcode of the current Query.</returns> public override int GetHashCode() { if (Label != null) { return(Label.GetHashCode()); } return(base.GetHashCode() ^ Deduction.GetHashCode()); }
private void deductionsToolStripMenuItem_Click(object sender, EventArgs e) { Deduction deduction; deduction = new Deduction(); deduction.MdiParent = this; deduction.Show(); }
private double Cal_DeductionScore(Deduction D) { double Score = 0; Score += D.Supervisior; Score += D.Accident; return(Score); }
public void DeductionModel_CalculatesNetDeduction_WhenThereIsNoDiscount() { var deduction = new Deduction { Discount = 0, Gross = 1000 }; Assert.AreEqual(1000, deduction.Net); }
public ActionResult EditDeduction(AddDeductionViewModel fromModel) { AssignedEmployeeDeductionBL assingedEmployeeBL = new AssignedEmployeeDeductionBL(); DeductionBL bL = new DeductionBL(); AddDeductionViewModel toModel = new AddDeductionViewModel(); Deduction deduction = new Deduction(); toModel.Deductions = new SelectList(bL.GetActiveDeductions(), "DeductionId", "DeductionName", 1); toModel.UserPersonalInformationId = fromModel.UserPersonalInformationId; toModel.DeductionId = fromModel.DeductionId; toModel.Name = fromModel.Name; //toModel.SelectedCustomAmount = fromModel.SelectedCustomAmount; deduction = bL.GetDeductionById(fromModel.DeductionId); if (deduction != null) { toModel.SelectedDeductionAmount = 0.0M; toModel.SelectedDeductionName = deduction.DeductionName; } else { toModel.SelectedDeductionAmount = fromModel.SelectedDeductionAmount; toModel.SelectedDeductionName = fromModel.SelectedDeductionName; } AssignedEmployeeDeduction toDB = new AssignedEmployeeDeduction(); if (ModelState.IsValid) { if (fromModel.DeductionId > 0) { toDB.UserPersonalInformationID = toModel.UserPersonalInformationId; //toDB.CustomAmount = toModel.SelectedCustomAmount; toDB.DeductionAmount = toModel.SelectedDeductionAmount; toDB.DeductionId = toModel.DeductionId; assingedEmployeeBL.UpdateEmployeeDeduction(toDB); } else { ModelState.AddModelError("", "Please select a Deduction."); return(View(toModel)); } } else { ModelState.AddModelError("", "Error."); return(View(toModel)); } return(RedirectToAction("AssignDeduction", "Home", new { id = fromModel.UserPersonalInformationId })); }
public virtual ActionResult EditDeductions(Deduction model) { var deduction = _deductionRepository.GetById(model.DeductionId); _deductionRepository.Update(deduction); deduction.DeductionName = model.DeductionName; deduction.Remarks = model.Remarks; _unitOfWork.Commit(); return(RedirectToAction("Deductions")); }
public IHttpActionResult GetDeduction(int id) { Deduction deduction = db.Deductions.Find(id); if (deduction == null) { return(NotFound()); } return(Ok(deduction)); }
private void Form_Load(object sender, EventArgs e) { if (ItemData.Id == 0) { return; } btnSelectDeduction.Enabled = false; _tempDeduction = ItemData.DeductionClass; ShowData(); }
public void deduction_amortization_adjusted_when_custom_payment_was_made() { var d = Deduction.Create(salary, 3, MonetaryValue.of("php", 1000)); var actual = d.AmortizedAmount.DecimalValue(); var p = DeductionPayment.Create(d, MonetaryValue.of("php", 700)); Assert.Equal(d.Balance.DecimalValue(), 300); Assert.Equal(d.Paid.DecimalValue(), 700); Assert.Equal(d.Total.subtractValueOf(d.Paid).DecimalValue(), d.Balance.DecimalValue()); Assert.Equal(d.AmortizedAmount.DecimalValue(), (1000 - 700) / (3 - 1)); Assert.NotEqual(d.AmortizedAmount.DecimalValue(), actual); }
public ActionResult Edit(int id) { Deduction deduction = deductionBL.GetDeductionById(id); DeductionViewModels model = new DeductionViewModels(); model = new DeductionViewModels(); model.Active = Convert.ToBoolean(deduction.Active); model.DeductionDescription = deduction.DeductionDescription; model.DeductionId = deduction.DeductionId; model.DeductionName = deduction.DeductionName; //model.DeductionValue = deduction.DeductionValue; model.Order = deduction.Order; return(View(model)); }
public Deduction CalculateDeductions(string firstName) { var deduction = new Deduction { Discount = 0, Gross = BaseBiweeklyDeduction }; if (IsEligibleForDiscount(firstName)) { deduction.Discount = CalculateDiscount(); } return(deduction); }
public static Deduction GetDeduction(int id) { IDataReader reader = DatabaseProvider.GetInstance().GetDeduction(id); Deduction model = null; if (reader.Read()) { model = GetDeduction(reader); } reader.Close(); return(model); }