public ActionResult Create() { PaymentOrderBE paymentOrder = new PaymentOrderBE(); ViewBag.Branch = branchRep.GetAllBranch(0).ToList(); ViewBag.Currency = paymentOrderRep.GetAllCurrency().ToList(); ViewBag.PaymentState = paymentOrderRep.GetAllPaymentState().ToList(); return(View(paymentOrder)); }
public ActionResult Edit(int id) { PaymentOrderBE paymentOrder = paymentOrderRep.GetAllPaymentOrder(0).Find(x => x.Id == id); ViewBag.Branch = branchRep.GetAllBranch(0).ToList(); ViewBag.Currency = paymentOrderRep.GetAllCurrency().ToList(); ViewBag.PaymentState = paymentOrderRep.GetAllPaymentState().ToList(); return(View(paymentOrder)); }
public ActionResult Delete(PaymentOrderBE paymentOrder) { try { if (!ModelState.IsValid) { return(View(paymentOrder)); } paymentOrderRep.DeletePaymentOrder(paymentOrder.Id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(PaymentOrderBE paymentOrder, FormCollection collection) { try { if (!ModelState.IsValid) { return(View(paymentOrder)); } paymentOrderRep.UpdatePaymentOrder(paymentOrder); return(RedirectToAction("Index")); } catch { return(View()); } }
public void AddPaymentOrder(PaymentOrderBE po) { Int32 r = 0; using (SqlConnection conn = new SqlConnection(ConnectionData.dbCn)) { conn.Open(); SqlCommand cmd = new SqlCommand("usp_addPaymentOrder", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@branch_id", SqlDbType.Int).Value = po.BranchId; cmd.Parameters.Add("@currency_id", SqlDbType.Int).Value = po.CurrencyId; cmd.Parameters.Add("@payment_state_id", SqlDbType.Int).Value = po.PaymentStateId; cmd.Parameters.Add("@amount", SqlDbType.Decimal).Value = po.Amount; r = cmd.ExecuteNonQuery(); } }
public ActionResult Create(PaymentOrderBE paymentOrder, FormCollection collection) { try { if (!ModelState.IsValid) { return(View(paymentOrder)); } paymentOrder.BranchId = Convert.ToInt32(collection["Branch"].ToString()); paymentOrder.CurrencyId = Convert.ToInt32(collection["Currency"].ToString()); paymentOrder.PaymentStateId = Convert.ToInt32(collection["PaymentState"].ToString()); paymentOrderRep.AddPaymentOrder(paymentOrder); return(RedirectToAction("Index")); } catch { return(View()); } }
public List <PaymentOrderBE> GetAllPaymentOrder(Int32 CurrencyId) { List <PaymentOrderBE> paymentOrderList = new List <PaymentOrderBE>(); using (SqlConnection conn = new SqlConnection(ConnectionData.dbCn)) { conn.Open(); SqlCommand cmd = new SqlCommand("usp_paymentOrderList", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@currency_id", SqlDbType.Int).Value = CurrencyId; using (SqlDataReader dr = cmd.ExecuteReader()) { PaymentOrderBE po; while (dr.Read()) { po = new PaymentOrderBE(); po.Id = Convert.ToInt32(dr["id"].ToString()); po.Amount = Convert.ToDecimal(dr["amount"].ToString()); po.PaymentDate = Convert.ToDateTime(dr["payment_date"]); po.BranchId = Convert.ToInt32(dr["branch_id"].ToString()); po.BranchName = dr["branch_name"].ToString(); po.CurrencyId = Convert.ToInt32(dr["currency_id"].ToString()); po.CurrencyName = dr["currency_name"].ToString(); po.CurrencySymbol = dr["currency_symbol"].ToString(); po.CurrencyIso = dr["currency_iso"].ToString(); po.PaymentStateId = Convert.ToInt32(dr["payment_state_id"].ToString()); po.PaymentStateName = dr["payment_state_name"].ToString(); paymentOrderList.Add(po); } } } return(paymentOrderList); }
public ActionResult Delete(int id) { PaymentOrderBE paymentOrder = paymentOrderRep.GetAllPaymentOrder(0).Find(x => x.Id == id); return(View(paymentOrder)); }