/// <summary>添加商品</summary> /// <param name="num">数量</param> public void Add_Click(int num) { int iSPItemID = int.Parse(this.dgvSPItems.CurrentRow.Cells[0].Value.ToString()); SPItems objItem = new SPItems(iSPItemID); PayDetail objDetail = new PayDetail(); objDetail.PayID = ""; if (this._strPayId != "") { objDetail.PayID = this._strPayId; } objDetail.ItemID = iSPItemID; if (objItem.IsBonus == 1) { //不打折 objDetail.Bonus = 1; objDetail.Money = objItem.UnitPrice; } else { objDetail.Bonus = StaticValue.g_dBonus; //计算折后单价(四舍五入) objDetail.Money = decimal.Parse((decimal.Parse(StaticValue.g_dBonus.ToString()) * new SPItems(iSPItemID).UnitPrice).ToString("f0")); } objDetail.Number = num; if (this.ValidateData(objDetail.ItemID)) { this._lstDetail.Add(objDetail); } this.LoadSeledtedItemsList(); }
public ActionResult DeleteConfirmed(int id) { PayDetail payDetail = db.PayDetail.Find(id); db.PayDetail.Remove(payDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
//详细明细 public IActionResult ChargeListDetail(long payId) { var model = new PayDetail { Pay = db.vwCHIS_Charge_Pay.Find(payId), Formeds = db.vwCHIS_Charge_Pay_Detail_Formed.AsNoTracking().Where(m => m.PayId == payId), Herbs = db.vwCHIS_Charge_Pay_Detail_Herb.AsNoTracking().Where(m => m.PayId == payId), Extras = db.vwCHIS_Charge_Pay_Detail_ExtraFee.AsNoTracking().Where(m => m.PayId == payId) }; return(PartialView("_pvChargeListDetail", model)); }
public ActionResult Edit([Bind(Include = "pay_id,user_id,product_id,pay_money,pay_amount,pay_datecreated,bill_id")] PayDetail payDetail) { if (ModelState.IsValid) { db.Entry(payDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.product_id = new SelectList(db.Product, "product_id", "product_name", payDetail.product_id); ViewBag.user_id = new SelectList(db.User, "user_id", "user_pass", payDetail.user_id); ViewBag.bill_id = new SelectList(db.Bill, "bill_id", "bill_address", payDetail.bill_id); return(View(payDetail)); }
// GET: PayDetails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PayDetail payDetail = db.PayDetail.Find(id); if (payDetail == null) { return(HttpNotFound()); } return(View(payDetail)); }
/// <summary>计算折后金额。</summary> private void CalculateBonused() { decimal dPrice = 0; decimal dBonus = this.numBonus.Value; if (this._iDetailId == 0) { dPrice = StaticValue.g_lstTempPayDetails[this._iIndex].SPItem.UnitPrice; } else { PayDetail objDetail = new PayDetail(this._iDetailId); dPrice = objDetail.SPItem.UnitPrice; } this.numBonused.Value = decimal.Parse((dPrice * dBonus).ToString("f0")); }
private void frmPayDetail_Bonus_Load(object sender, EventArgs e) { PayDetail objDetail = new PayDetail(); if (this._iIndex > -1) { objDetail = StaticValue.g_lstTempPayDetails[this._iIndex]; } else if (this._iDetailId > 0) { objDetail = new PayDetail(this._iDetailId); } this.lblName.Text = objDetail.SPItem.Name; this.lblPrice.Text = "¥" + objDetail.SPItem.UnitPrice.ToString("f2"); this.numBonus.Value = decimal.Parse(objDetail.Bonus.ToString()); this.numBonused.Value = objDetail.Money; }
// GET: PayDetails/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PayDetail payDetail = db.PayDetail.Find(id); if (payDetail == null) { return(HttpNotFound()); } ViewBag.product_id = new SelectList(db.Product, "product_id", "product_name", payDetail.product_id); ViewBag.user_id = new SelectList(db.User, "user_id", "user_pass", payDetail.user_id); ViewBag.bill_id = new SelectList(db.Bill, "bill_id", "bill_address", payDetail.bill_id); return(View(payDetail)); }
/// <summary>确定按钮</summary> private void btnOk_Click(object sender, EventArgs e) { if (this._iDetailId == 0) { StaticValue.g_lstTempPayDetails[this._iIndex].Bonus = double.Parse(this.numBonus.Value.ToString()); StaticValue.g_lstTempPayDetails[this._iIndex].Money = this.numBonused.Value; } else { PayDetail objDetail = new PayDetail(); objDetail.DetailID = this._iDetailId; objDetail.Bonus = double.Parse(this.numBonus.Value.ToString()); objDetail.Money = this.numBonused.Value; objDetail.UpdateDetailBonus(); } DialogResult = DialogResult.OK; this.Close(); }
// Lưu bill vào csdl public RedirectToRouteResult PayDetail(int id) { List <ShoppingCarts> ghtt = Session["sptt"] as List <ShoppingCarts>; User user = (User)Session["user"]; foreach (var item in ghtt) { PayDetail dh = new PayDetail(); dh.bill_id = id; dh.product_id = item.product_id; dh.user_id = user.user_id; dh.pay_amount = item.pay_amount; dh.pay_money = item.pay_money; dh.pay_datecreated = DateTime.Now; db.PayDetail.Add(dh); } db.SaveChanges(); Session["sptt"] = null; return(RedirectToAction("Index", "Display")); }
/// <summary> /// 写入支付信息 /// </summary> /// <param name="id"></param> /// <param name="payConfigId"></param> /// <param name="amount"></param> /// <returns></returns> public JsonResult WritePayInfo(int id, int payConfigId, string amount) { try { //获取订单对象 var oderModel = _orderService.GetById(id); oderModel.OrderStatusId = (int)EnumHelp.OrderStatus.已付款; PayDetail pd = _payDetailService.GetDetailByOrderNo(oderModel.OrderNo); pd.Remark = ""; pd.PayType = (int)EnumHelp.PayType.商家付款; pd.PayTime = DateTime.Now; pd.PayStatus = (int)EnumHelp.PayStatus.已支付; pd.Amount = decimal.Parse(amount); //写入支付信息 _payDetailService.Update(pd); //更新订单状态 _orderService.Update(oderModel); //记录订单状态变更信息 var model = new OrderStatusLog() { OrderId = id, Status = (int)EnumHelp.OrderStatus.已付款, StatusName = EnumHelp.OrderStatus.已付款.ToString(), CreateTime = DateTime.Now }; _orderStatusLogService.Insert(model); return(Json(new { Status = Successed.Ok }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Status = Successed.Error }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 删除实体 /// </summary> /// <param name="model"></param> /// <returns></returns> public void Delete(PayDetail model) { this._PayDetailBiz.Delete(model); }
/// <summary> /// 修改实体 /// </summary> /// <param name="model"></param> /// <returns></returns> public void Update(PayDetail model) { this._PayDetailBiz.Update(model); }
/// <summary> /// 添加实体 /// </summary> /// <param name="model"></param> /// <returns></returns> public PayDetail Insert(PayDetail model) { return(this._PayDetailBiz.Insert(model)); }
public PayDetail Insert(PayDetail model) { return(this._repoPayDetail.Insert(model)); }
/// <summary> /// 修改实体 /// </summary> /// <param name="model"></param> /// <returns></returns> public void Update(PayDetail model) { this._repoPayDetail.Update(model); }
/// <summary> /// 删除实体 /// </summary> /// <param name="model"></param> /// <returns></returns> public void Delete(PayDetail model) { this._repoPayDetail.Delete(model); }
public IActionResult GetByPayId([FromBody] PayDetail pay) { var pays = _repository.GetByPayId(pay.PayId); return(new JsonResult(pays)); }