public void InsertPayment(payments payment) { using (OrdersPaymentsDBEntities db = new OrdersPaymentsDBEntities()) { db.Database.ExecuteSqlCommand($@"insert into payments(money_id, order_id, payment_sum) values ({payment.money_id}, {payment.order_id}, {payment.payment_sum})"); } }
public ActionResult Edit([Bind(Include = "id,date,payment_value,id_subscriber_tariff")] payments payments) { if (ModelState.IsValid) { db.Entry(payments).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_subscriber_tariff = new SelectList(db.subscriber_tariff_list, "id", "id", payments.id_subscriber_tariff); return(View(payments)); }
public void AddPayment(string establishment_name, int customer_number, float user_balance, float payment_amount) { payments pay = new payments(); pay.establishment_name = establishment_name; pay.customer_number = customer_number; pay.user_balance = user_balance; pay.payment_amount = payment_amount; db.payments.Add(pay); db.SaveChanges(); }
public ActionResult Edit(int id = 0) { using (dbcon db = new dbcon()) { if (id == 0) { payments new_model = new payments(); return(View(new_model)); } var models = db.payments.Where(m => m.rowid == id).FirstOrDefault(); return(View(models)); } }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } payments payments = db.payments.Find(id); if (payments == null) { return(HttpNotFound()); } return(View(payments)); }
// GET: Payments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } payments payments = db.payments.Find(id); if (payments == null) { return(HttpNotFound()); } ViewBag.id_subscriber_tariff = new SelectList(db.subscriber_tariff_list, "id", "id", payments.id_subscriber_tariff); return(View(payments)); }
public void Payments_Test1() { string[] errors = new string[] { }; payments t_payments = null; patients t_patients = null; _dentnedModel.Patients.Remove(_dentnedModel.Patients.List(r => r.patients_name == "XX1" && r.patients_surname == "XX1").ToArray()); t_patients = new patients() { patients_name = "XX1", patients_surname = "XX1", patients_birthdate = DateTime.Now, patients_birthcity = "xxx", patients_doctext = "xxx", patients_sex = "M", patients_username = "******", patients_password = "******" }; _dentnedModel.Patients.Add(t_patients); t_payments = new payments() { payments_amount = (decimal) - 20, payments_date = DateTime.Now, patients_id = t_patients.patients_id }; Assert.IsFalse(_dentnedModel.Payments.CanAdd(t_payments)); t_payments = new payments() { payments_amount = (decimal)10.10, payments_date = DateTime.Now, //patients_id = t_patients.patients_id }; Assert.IsFalse(_dentnedModel.Payments.CanAdd(t_payments)); t_payments = new payments() { payments_amount = (decimal)10.10, payments_date = DateTime.Now, patients_id = t_patients.patients_id }; Assert.IsTrue(_dentnedModel.Payments.CanAdd(t_payments)); _dentnedModel.Payments.Add(t_payments); _dentnedModel.Patients.Remove(_dentnedModel.Patients.List(r => r.patients_name == "XX1" && r.patients_surname == "XX1").ToArray()); }
public void deletePayrollData(payments record) { var payment_details = (from e in fmp.payments_details where e.payment_id == record.payment_id select e).ToList <payments_details>(); var payment_reimbursement = (from e in fmp.payments_reimbursements where e.payment_id == record.payment_id select e).ToList <payments_reimbursements>(); foreach (payments_details item in payment_details) { fmp.payments_details.Remove(item); } foreach (payments_reimbursements item in payment_reimbursement) { fmp.payments_reimbursements.Remove(item); } }
public void InsertPayment(payments payment) { _paymentsRepository.InsertPayment(payment); }
public Json store(string programming_id, string client, string quantity, String element) { int id = int.Parse(programming_id); String[] elements = element.Split('-');; programming programming = this.Context.programming.First(x => x.id == id); int q = int.Parse(quantity); // Todo: Validate quotas using (var transaction = Context.Database.BeginTransaction()) { payments pay = this.Context.payments.Add(new payments() { programming_id = programming.id, price = programming.movies.price, client = client, headquarter_id = 1, quantity = q, creator_by = 1 }); Boolean isSuccess = this.Context.SaveChanges() > 0; if (isSuccess) { List <products> products = this.Context.products.Where(x => elements.Contains(x.id.ToString())).ToList(); products.ForEach(x => { pay.payment_detail.Add(new payment_detail() { price = x.price, product_id = x.id, quantity = Repository.quantity }); }); isSuccess = this.Context.SaveChanges() > 0; } if (!isSuccess || !this.updateOccupiedProperty(programming, q)) { transaction.Rollback(); return(new Json() { success = false, message = "Error registering" }); } transaction.Commit(); return(new Json() { success = true, message = String.Format("was registered for {0}", client) }); } }
public IHttpActionResult save(dynamic payrollData) { using (TransactionScope scope = new TransactionScope()) { try { string username = Request.Headers.GetValues("logusr").FirstOrDefault(); payments p = new payments(); bool editing = false; if (payrollData.payment_id != null) { int payment_id = payrollData.payment_id; p = (from py in fmp.payments where py.payment_id == payment_id select py).FirstOrDefault <payments>(); editing = true; } else { p = new payments(); } p.startdate = Convert.ToDateTime(payrollData.startdate); p.enddate = Convert.ToDateTime(payrollData.enddate); p.username = username; if (!editing) { p.payment_code = getNextPaymentCode(username); fmp.payments.Add(p); updatePaymentCode(username); } else { deletePayrollData(p); } fmp.SaveChanges(); foreach (dynamic employee in payrollData.employees) { foreach (dynamic day in employee.days) { payments_details detail = new payments_details(); detail.required_hours = Convert.ToDecimal(day.regularHours); detail.overtime = Convert.ToDecimal(day.overtime); detail.day = Convert.ToString(day.day); detail.date = Convert.ToDateTime(day.date); detail.payment_id = p.payment_id; detail.employee_code = Convert.ToString(employee.employee.employee_code); detail.payrate = Convert.ToDecimal(employee.employee.title.payrate); detail.comments = day.comment; fmp.payments_details.Add(detail); if (day.reimbursements != null) { foreach (dynamic reimbursement in day.reimbursements) { payments_reimbursements pr = new payments_reimbursements(); pr.comment = Convert.ToString(reimbursement.comment); pr.hours = Convert.ToDecimal(reimbursement.hours); pr.rate = Convert.ToDecimal(reimbursement.rate); pr.reimbursement_type = Convert.ToInt32(reimbursement.type); pr.payment_id = p.payment_id; pr.reimbursement_id = Convert.ToInt32(reimbursement.obj.id); pr.day = Convert.ToString(day.day); pr.date = Convert.ToDateTime(day.date); pr.employee_code = Convert.ToString(employee.employee.employee_code); fmp.payments_reimbursements.Add(pr); } } } } fmp.SaveChanges(); scope.Complete(); } catch (Exception e) { return(InternalServerError(e)); } } return(Ok("1")); }