public ActionResult Buy(string phone, string name) { // lưu bảng bill -> idbill BillDao dao = new BillDao(); Bill bill = new Bill(); bill.username = name; bill.iduser = phone; int id = dao.Add(bill); ShoppingCart cart = (ShoppingCart)Session["cart"]; if (cart != null) { List <ItemCart> ListCart = cart.ListItem; List <BilDetail> ls = new List <BilDetail>(); for (int i = 0; i < ListCart.Count; i++) { BilDetail billdetail = new BilDetail(); billdetail.idbill = idbill; billdetail.idproduct = idproduct; billdetail.quantity = ListCart[i].quantity; billdetail.prict = (decimal)ListCart[i].price; ls.Add(billdetail); // lưu bảng billandProduct dao.addBillDetai(ls); } } Session["cart"] = null; return(View()); }
public ActionResult Detail(int id) { var dao = new BillDao(); var model = dao.GetBillDetail(id); return(View(model)); }
public ActionResult Show(int hd_id) { var hoadon = new BillDao().Show(hd_id); ViewData["bangChu"] = ChuyenSoSangChuoi((double)hoadon.hd_tongtien); return(View(hoadon)); }
public JsonResult StatisticSubmit(int lotrinh, int kyghi) { BillDao db = new BillDao(); var result = new StatisticViewModel(); if (lotrinh == 0 && kyghi == 0) { result = db.StatisticAll(); } else if (lotrinh != 0 && kyghi == 0) { result = db.StatisticLT(lotrinh); } else if (lotrinh == 0 && kyghi != 0) { result = db.StatisticKG(kyghi); } else { result = db.StatisticLTKG(lotrinh, kyghi); } var data = new { lt_ten = result.lt_ten, k_ten = result.k_ten, soho = result.soho, sonuoc = result.sonuoc, tongtien = result.tongtien }; var j = Json(data, JsonRequestBehavior.AllowGet); return(j); }
public ActionResult Index(int searchString = 0, int page = 1) { int pagesize = 4; var dao = new BillDao(); var model = dao.GetAllBill(searchString, page, pagesize); return(View(model)); }
public DataTable GetFormula() { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); return(dao.GetFormula()); } }
public DataTable GetBillByType(string BillType) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); return(dao.GetBillByType(BillType)); } }
public DataTable GetBillTaskDetail(string TaskID) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); return(dao.GetBillTaskDetail(TaskID)); } }
/// <summary> /// 单据出库完成 /// </summary> /// <param name="BillNo"></param> /// <param name="IsBill"></param> public void UpdateOutBillMasterFinished(string BillNo) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); dao.UpdateOutBillMasterFinished(BillNo); } }
/// <summary> /// 单据开始运行 /// </summary> /// <param name="BillNo"></param> /// <param name="IsBill"></param> public void UpdateBillMasterStart(string BillNo, bool IsBill) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); dao.UpdateBillMasterStart(BillNo, IsBill); } }
/// <summary> /// 获取堆垛机运行任务 /// </summary> /// <param name="CraneNo"></param> /// <returns></returns> public DataTable GetCranTaskByCraneNo(string CraneNo) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); return(dao.GetCranTaskByCraneNo(CraneNo)); } }
// GET: Admin/Bill public ActionResult Index(string searchString, int page = 1, int pageSize = 10) { var dao = new BillDao(); var model = dao.ListAllPaging(searchString, page, pageSize); ViewBag.SearchString = searchString; return(View(model)); }
public ActionResult Paid(hoadon hd) { int nv_id = (int)((UserLogin)System.Web.HttpContext.Current.Session[QuanLyCapNuoc.common.CommonConstants.NV_SESSION]).nv_id; BillDao db = new BillDao(); db.Paid(hd.hd_id, nv_id); return(RedirectToAction("Show", "Bill", new { hd.hd_id })); }
public DataTable GetBillOutTask(string filter) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); return(dao.GetBillOutTask(filter)); } }
/// <summary> /// 空托盘组出库申请 /// </summary> public string CreatePalletOutBillTask(string TARGET_CODE) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); return(dao.CreatePalletOutBillTask(TARGET_CODE)); } }
/// <summary> /// 根据 错误烟包 查找相同入库单据信息,供用户选择入库单号。 /// </summary> /// <returns></returns> public DataTable GetCancelBillNo(string TaskID, string CraneNo) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); return(dao.GetCancelBillNo(TaskID, CraneNo)); } }
public JsonResult DeleteBill(int id) { var check = new BillDao().DeleteBill(id); return(Json(new { status = check }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 二楼出库堆垛机出现问题,由用户选定出库的入库单号OutBillNO(其它堆垛机编号的入库单), 补充生成新出库单。 /// </summary> /// <returns>TaskID</returns> public string CreateCancelBillOutTask(string TaskID, string BillNo, string OutBillNO, string CraneNo) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); string strTaskID = dao.CreateCancelBillOutTask(TaskID, BillNo, OutBillNO, CraneNo); return(strTaskID); } }
private ApplicationA() { Companies = new ObservableCollection <Company>(); Carpets = new ObservableCollection <Carpet>(); Bills = new ObservableCollection <Bill>(); Companies = CompanyDao.Load(); Carpets = CarpetDao.Load(); Bills = BillDao.Load(); //billMaxHelper.fillCompanyBills(); }
public ActionResult Statistic() { BillDao db = new BillDao(); List <lotrinh> lt = db.DanhSachLoTrinh(); List <kyghi> kg = db.DanhSachKyGhi(); ViewData["lt"] = lt; ViewData["kg"] = kg; return(View()); }
public ActionResult Payment(BillDTO model) { if (ModelState.IsValid) { var carts = (List <CartItem>)Session[CommonConstant.CART_SESSION]; var user = (UserSession)Session[CommonConstant.USER_SESSION]; decimal totalPrice = 0; string tblData = ""; Dictionary <int, List <string> > hash = new BillDao().AddBill(carts, model, user.UserId); if (hash.ContainsKey(1)) { try { string content = System.IO.File.ReadAllText(Server.MapPath("~/Assets/user/orderBill.html")); content = content.Replace("{{username}}", user.UserName); content = content.Replace("{{customername}}", model.username); content = content.Replace("{{phone}}", model.phone); content = content.Replace("{{shiptoaddress}}", model.shiptoaddress); content = content.Replace("{{email}}", model.email); foreach (var item in carts) { decimal p = item.catalog.price * item.quantity; totalPrice += p; tblData += "<tr><td>" + item.catalog.name + "</td><td>" + item.quantity + "</td><td>" + string.Format("{0:0,0} VNĐ", p) + "</td></tr>"; } content = content.Replace("{{tblData}}", tblData); content = content.Replace("{{price}}", string.Format("{0:0,0 VNĐ}", totalPrice)); new MailHelper().SendEmail(model.email, "Hóa đơn thanh toán từ Mobile World", content); Session[CommonConstant.CART_SESSION] = null; Session[CommonConstant.CART_TOTAL_PRICE_SESSION] = 0; TempData["Message"] = "Đặt hàng thành công. Hóa đơn được gửi vào email của bạn"; return(RedirectToAction("index", "cart")); } catch (Exception) { return(RedirectToAction("index", "error")); } } else if (hash.ContainsKey(0)) { string msg = "Có sản phẩm đã hết hàng: "; msg += hash[0][0]; for (int i = 1; i < hash[0].Count; i++) { msg += ", " + hash[0][i]; } TempData["Message"] = msg; } else { TempData["Message"] = "Lỗi đặt hàng!"; } } return(View("index")); }
public JsonResult UpdateBill(string model) { JavaScriptSerializer serializer = new JavaScriptSerializer(); var bill = serializer.Deserialize <BillDTO>(model); var check = new BillDao().UpdateBill(bill.id, bill.status); return(Json(new { status = check }, JsonRequestBehavior.AllowGet)); }
public JsonResult LoadData(string seach, int status, int month, int page, int pageSize) { PagedResult <BillDTO> result; result = new BillDao().LoadData(null, seach, status, month, page, pageSize); return(Json(new { totalRow = result.TotalRecord, data = result.Items }, JsonRequestBehavior.AllowGet)); }
public IEnumerable <BillDto> GetBills() { var data = new BillDao().GetBills().OrderBy(d => d.dateCreate).Select(s => new BillDto { id = s.id, idCode = s.idCode, dateCreate = s.dateCreate, totalExpenses = s.totalExpenses, status = s.status }); return(data); }
public BillDto GetBillById(int id) { var s = new BillDao().GetBillById(id); return(new BillDto { id = s.id, idCode = s.idCode, dateCreate = s.dateCreate, totalExpenses = s.totalExpenses, status = s.status }); }
/// <summary> /// 二楼退库单据,产生任务,任务明细,更新货位错误标志, 返回任务ID。 /// </summary> /// /// <returns>TaskID</returns> public string CreateCancelBillInTask(string TaskID, string BillNo) { using (PersistentManager pm = new PersistentManager()) { BillDao dao = new BillDao(); string strTaskID = dao.CreateCancelBillInTask(TaskID, BillNo); TaskDao tdao = new TaskDao(); tdao.InsertTaskDetail(strTaskID); tdao.UpdateTaskState(strTaskID, "1");//更新任务开始执行 return(strTaskID); } }
public void Delete(Bill bill) { Require.NotNull(bill, "bill"); if (bill.IsSettled) { throw new InvalidOperationException("Eine abgerechnete Rechnung darf nicht gelöscht werden!"); } Peanut billForPeanut = PeanutService.FindFromBill(bill); if (billForPeanut != null) { billForPeanut.RemoveAssociatedBill(bill); } BillDao.Delete(bill); }
public Bill Create(UserGroup userGroup = null, UserGroupMembership creditor = null, string subject = DEFAULT_BILL_SUBJECT, double amount = DEFAULT_BILL_AMOUNT, IList <BillUserGroupDebitorDto> userGroupDebitorsDtos = null, IList <BillGuestDebitorDto> guestDebitorDtos = null, DateTime?settleDate = null, bool persist = true) { if (userGroupDebitorsDtos == null && guestDebitorDtos == null) { userGroupDebitorsDtos = new List <BillUserGroupDebitorDto>(); guestDebitorDtos = new List <BillGuestDebitorDto> { new BillGuestDebitorDto("Guest Debitor", "*****@*****.**", 1) }; } else if (userGroupDebitorsDtos == null) { userGroupDebitorsDtos = new List <BillUserGroupDebitorDto>(); } else if (guestDebitorDtos == null) { guestDebitorDtos = new List <BillGuestDebitorDto>(); } if (userGroup == null) { userGroup = UserGroupCreator.Create(persist: persist); } if (creditor == null) { creditor = UserGroupMembershipCreator.Create(userGroup, persist: persist); } BillDto billDto = CreateBillDto(subject, amount); IList <BillUserGroupDebitor> userGroupDebitors = userGroupDebitorsDtos.Select(dto => new BillUserGroupDebitor(dto.UserGroupMembership, dto.Portion)).ToList(); IList <BillGuestDebitor> guestDebitors = guestDebitorDtos.Select(dto => new BillGuestDebitor(dto.Name, dto.Email, dto.Portion)).ToList(); Bill bill = new Bill(userGroup, billDto, creditor, userGroupDebitors, guestDebitors, new EntityCreatedDto(creditor.User, DateTime.Now)); if (settleDate.HasValue) { bill.Settle(new EntityChangedDto(bill.Creditor.User, settleDate.Value)); } if (persist) { BillDao.Save(bill); BillDao.Flush(); } return(bill); }
public ActionResult Create(Order bill1) { if (ModelState.IsValid) { var dao = new BillDao(); long id = dao.Insert(bill1); if (id > 0) { return(RedirectToAction("Index", "Bill")); } else { ModelState.AddModelError("", "Thêm hóa đơn thành công"); } } return(RedirectToAction("Index", "Bill")); }
public ActionResult Edit(Bill Bill) { if (ModelState.IsValid) { var dao = new BillDao(); var result = dao.Update(Bill); if (result) { return(RedirectToAction("Index", "Bill")); } else { ModelState.AddModelError("", "Modify Bill successfully"); } } return(View("Index")); }
public List<Bill> Query(BillQueryForm form) { ISqlMapper mapper = MapperHelper.GetMapper(); BillDao dao = new BillDao(mapper); return dao.Query(form); }
public bool Update(BillUpdateForm bill) { ISqlMapper mapper = MapperHelper.GetMapper(); BillDao dao = new BillDao(mapper); return dao.Update(bill); }
public string Add(Bill bill) { ISqlMapper mapper = MapperHelper.GetMapper(); BillDao dao = new BillDao(mapper); return dao.Add(bill); }
public BillModel QuerySingle(string BillID) { ISqlMapper mapper = MapperHelper.GetMapper(); BillDao dao = new BillDao(mapper); OtherFeeDao ofdao = new OtherFeeDao(mapper); House_OtherFeeDao hodao = new House_OtherFeeDao(mapper); OtherFeeBillDao ofbdao = new OtherFeeBillDao(mapper); var bill = dao.QueryFullBill(new QueryFullBillServiceForm { ID = BillID }).FirstOrDefault(); BillModel model = new BillModel { Bill = bill, }; if (bill == null) return model; var house_otherfees = hodao.Query(new House_OtherFeeQueryForm { HouseOrRoomID = bill.HouseOrRoomID }); var otherfeeids = (from ho in house_otherfees select ho.OtherFeeID).ToList(); var otherfeebills = ofbdao.Query(new OtherFeeBillQueryForm { BillID = bill.ID, }); var otherfees = ofdao.Query(new OtherFeeQueryForm { IDs = otherfeeids }); var fullotherfeebills = new List<FullOtherFeeBill>(); foreach (var ho in house_otherfees) { FullOtherFeeBill ofb = new FullOtherFeeBill { House_OtherFee = ho, OtherFee = otherfees.Find(t => t.ID.Equals(ho.OtherFeeID)), OtherFeeBill = otherfeebills.Find(t => t.OtherFeeID.Equals(ho.OtherFeeID)), }; fullotherfeebills.Add(ofb); } model.OtherFeeBill = fullotherfeebills; return model; }
public bool Delete(BillQueryForm bill) { ISqlMapper mapper = MapperHelper.GetMapper(); BillDao dao = new BillDao(mapper); return dao.Delete(bill); }
public DataTable QueryFullBill(QueryFullBillServiceForm form) { #region 初始化数据 ISqlMapper mapper = MapperHelper.GetMapper(); BillDao dao = new BillDao(mapper); OtherFeeDao ofbll = new OtherFeeDao(mapper); OtherFeeBillDao ofbbll = new OtherFeeBillDao(mapper); var bills = dao.QueryFullBill(form); var billids = (from b in bills select b.ID).ToList(); var houseids = (from b in bills select b.HouseOrRoomID).ToList(); var otherfee = ofbll.Query(new OtherFeeQueryForm { }); var otherfeebills = ofbbll.Query(new OtherFeeBillQueryForm { BillIDs = billids }); var linkedOtherfeeBills = (from b in otherfeebills join o in otherfee on b.OtherFeeID equals o.ID select new { ID = b.ID, Fee = b.Fee, Name = o.Name, BillID = b.BillID, }).ToList(); #endregion #region 设置字段mapping List<ToDataTableMapping> list = new List<ToDataTableMapping> { new ToDataTableMapping { OrignalName = "Name", MappingName = "账单名称" }, new ToDataTableMapping { OrignalName = "ShouldPay",MappingName = "应收" }, new ToDataTableMapping { OrignalName = "Payed", MappingName = "已收" }, new ToDataTableMapping { OrignalName = "PayDay", MappingName="交租日期" }, new ToDataTableMapping { OrignalName = "HouseOrRoomID", MappingName="房间ID" }, new ToDataTableMapping { OrignalName = "ID", MappingName="ID" }, new ToDataTableMapping { OrignalName = "BuildingName", MappingName="楼栋名称" }, new ToDataTableMapping { OrignalName = "HouseName", MappingName = "房间名称" }, }; #endregion #region 组装数据 DataTable table = bills.ToDataTable(list); foreach (var of in otherfee) { if (!table.Columns.Contains(of.Name)) { DataColumn column = new DataColumn(of.Name, typeof(decimal)); column.DefaultValue = 0; table.Columns.Add(column); } } foreach (DataRow row in table.Rows) { foreach (var ofb in linkedOtherfeeBills) { row[ofb.Name] = ofb.Fee; } } #endregion return table; }
public bool Update(BillModel model) { if (model == null) throw new Exception("model不能为null"); if (model.Bill == null) throw new Exception("bill不能为null"); if (string.IsNullOrEmpty(model.Bill.ID)) throw new Exception("Bill.ID不能为空"); ISqlMapper mapper = MapperHelper.GetMapper(); BillDao billdao = new BillDao(mapper); OtherFeeBillDao ofbdao = new OtherFeeBillDao(mapper); billdao.Update(new BillUpdateForm { Entity = new Bill { ShouldPay = model.Bill.ShouldPay, Payed = model.Bill.Payed, }, BillQueryForm = new BillQueryForm { ID = model.Bill.ID }, }); if (model.OtherFeeBill != null) { foreach (var ofb in model.OtherFeeBill) { if (ofb.OtherFeeBill == null || string.IsNullOrEmpty(ofb.OtherFeeBill.ID)) continue; ofbdao.Update(new OtherFeeBillUpdateForm { Entity = new OtherFeeBill { StartValue = ofb.OtherFeeBill.StartValue, EndValue = ofb.OtherFeeBill.EndValue, Fee = ofb.OtherFeeBill.Fee, }, OtherFeeBillQueryForm = new OtherFeeBillQueryForm { ID = ofb.OtherFeeBill.ID }, }); } } return true; }