private void BindTableData() { var type = this.hOrderStatus.Value; if (string.IsNullOrEmpty(type)) { type = "1"; } this.lType.InnerText = GetTypeName(type); if (type == "0") { type = null; } int?restaurantId = base.ParseInt(this.ddlRestaurant.SelectedValue); if (restaurantId == 0) { restaurantId = null; } IOrder biz = new OrderBiz(); DataTable dt = (bool)base.CurEmployeeEntity.IS_ADMIN ? biz.GetOrderMainDataTable(restaurantId, type) : biz.GetOrderMainDataTable(base.CurEmployeeEntity.RESTAURANT_ID, type); repeater1.DataSource = GetPagedDataSource(dt.DefaultView); repeater1.DataBind(); }
private void OperateOrder() { try { if (!string.IsNullOrEmpty(this.hOperationId.Value)) { var op = this.hOperationId.Value.Split('|')[0]; var id = base.ParseInt(this.hOperationId.Value.Split('|')[1]); IOrder biz = new OrderBiz(); var condition = new OrderMainEntity(); condition.ORDER_ID = id; if (op == "finish") { condition.ORDER_FLAG = "2"; biz.UpdateOrderMainEntity(condition); this.lMsg.InnerText = "完成订单成功!"; } else if (op == "cancel") { condition.ORDER_FLAG = "3"; biz.UpdateOrderMainEntity(condition); this.lMsg.InnerText = "取消订单成功!"; } } } catch (Exception ex) { this.lMsg.InnerText = "操作失败,原因:" + ex.ToString(); } }
public JsonResult CreateOrder(string prodId, string num) { string userOpenId = base.getUserOpenIdFromCookie(); string res = "fail"; if (!string.IsNullOrEmpty(userOpenId)) { try { string salesNo = WxPayApi.GenerateOutTradeNo();// Guid.NewGuid().ToString(); OrderBiz.CreateNew().createOrder(prodId, num, userOpenId, salesNo); res = salesNo; } catch (Exception e) { res = "fail"; _Apilog.WriteLog("ProductsController/CreateOrder 异常: " + e.Message); } } else { _Apilog.WriteLog("ProductsController/CreateOrder 用户userOpenId 为空: " + prodId + " " + num); } return(Json(res)); }
public void ProcessRequest(HttpContext context) { try { var tableId = Helper.ParseInt(context.Request.QueryString["tid"]); var restaurantId = Helper.ParseInt(context.Request.QueryString["rid"]); var orderData = context.Request.Form["orderData"]; var price = Helper.ParseDecimal(context.Request.Form["price"]); IOrder orderBiz = new OrderBiz(); var condition = new OrderMainEntity(); condition.RESTAURANT_ID = restaurantId; condition.TABLE_ID = tableId; condition.ORDER_FLAG = "1"; var list = orderBiz.GetOrderMainEntityList(condition); if (list != null && list.Count > 0) { context.Response.Write("{\"success\":0,\"msg\":\"上个订单还未结束,不能创建新的订单,请重新重新刷新页面!\"}"); return; } var list2 = JsonToObjects(orderData); if (list2 != null && list2.Count > 0) { var orderId = orderBiz.CreateOrder(restaurantId, tableId, price, list2); context.Response.Write("{\"success\":1,\"id\":" + orderId.ToString() + "}"); } } catch (Exception ex) { context.Response.Write("{\"success\":0,\"msg\":\"订单数据有误,原因是" + ex.ToString() + "!\"}"); } }
/// <summary> /// 获取用户订单列表 /// </summary> /// <param name="code"></param> /// <param name="status">0未付款 1已付款待发货 2 已发货,待收货 3 已完成 4 已删除取消订单 5 预付款</param> /// <returns></returns> public ActionResult OrderList(string code, string status) { #region 用户信息部分 string userOpenId = string.Empty; Tuple <string, string> result = base.getUserOpenId(code); if (!string.IsNullOrEmpty(result.Item1)) { userOpenId = result.Item1; } else if (!string.IsNullOrEmpty(result.Item2)) { return(Redirect(result.Item2)); } ViewBag.userOpenId = userOpenId; #endregion List <GanXian.Model.UserOrderListInfo> userOrderList = new List <GanXian.Model.UserOrderListInfo>(); try { userOrderList = OrderBiz.CreateNew().getUserOrderListInfo(userOpenId); if (status.ToLower() != "all") { userOrderList = userOrderList.Where(x => x.status == Convert.ToInt32(status)).ToList(); } } catch (Exception e) { _Apilog.WriteLog("OrderController 的OrderList 异常:" + e.Message); } ViewBag.PageName = "我的订单"; ViewBag.ProjectUrl = base.projectURL; return(View(userOrderList)); }
private void RefreshItems(object sender, EventArgs e) { var biz = new OrderBiz(); radGridView.DataSource = biz.LoadItems(); radGridView.Refresh(); }
private void LoadDataSource() { var biz = new OrderBiz(); dataGridView.DataSource = biz.LoadItemsToDashBoard(); dataGridView.Refresh(); }
public async Task <IActionResult> GetMerchantOrderPageListAsync([FromQuery] GetMerchantOrderPageListRequestDto requestDto) { var orderBiz = new OrderBiz(); var orderList = await orderBiz.GetMerchantOrderPageListAsync(requestDto); if (!orderList.CurrentPage.Any()) { return(Success(orderList)); } var orderIds = orderList.CurrentPage.Select(a => a.OrderGuid).ToList(); var products = await orderBiz.GetOrderProductListV2Async(orderIds); var productIds = products.Select(a => a.ProductGuid).Distinct().ToList(); var projects = await orderBiz.GetOrderProductProjectsAsync(productIds); foreach (var order in orderList.CurrentPage) { order.Products = products.Where(a => a.OrderGuid == order.OrderGuid).OrderBy(a => a.ProductName).ToList(); foreach (var product in order.Products) { product.Projects = projects.Where(a => a.ProductGuid == product.ProductGuid).OrderBy(a => a.ProjectName).ToList(); } } return(Success(orderList)); }
public JsonResult SelAddress(string receiver, string rPhone, string province, string city, string county, string detailAddress, string orderId) { string userOpenId = base.getUserOpenIdFromCookie(); salesslip userSalesSlip = new salesslip(); string res = "fail"; try { userSalesSlip = OrderBiz.CreateNew().getCheckOutInfo(orderId, userOpenId); userSalesSlip.receiver = receiver; userSalesSlip.province = province; userSalesSlip.city = city; userSalesSlip.county = county; userSalesSlip.detailAddress = detailAddress; userSalesSlip.Phone = rPhone; OrderBiz.CreateNew().userUpdateOrderAddress(userSalesSlip); } catch (Exception ex) { _Apilog.WriteLog("ProductsController/SelAddress 异常: " + userOpenId + " orderId: " + orderId + ex.Message); } return(Json(res)); }
private void BindControlData() { IOrder orderBiz = new OrderBiz(); var entity = orderBiz.GetOrderMainEntity(OrderId); this.hOrderStatus.Value = entity.ORDER_FLAG; this.lTableId.InnerText = "桌号为:" + entity.TABLE_ID; }
private void CreateBoundHierarchy() { var deliveryBiz = new DeliveryBiz(); using (this.radGridView.DeferRefresh()) { this.radGridView.MasterTemplate.Reset(); this.radGridView.AutoGenerateColumns = true; this.radGridView.AllowCellContextMenu = false; this.radGridView.ReadOnly = true; this.radGridView.TableElement.RowHeight = 20; this.radGridView.DataSource = deliveryBiz.GetTemplateData(); this.radGridView.MasterTemplate.Columns["Vehicle"].HeaderText = "Xe"; this.radGridView.MasterTemplate.Columns["DeliveryNo"].HeaderText = "Số giao hàng"; this.radGridView.MasterTemplate.Columns["DeliveryDate"].HeaderText = "Ngày giao"; this.radGridView.MasterTemplate.Columns["StartTime"].HeaderText = "Giờ giao"; this.radGridView.MasterTemplate.Columns["Status"].HeaderText = "Tình trạng"; this.radGridView.MasterTemplate.Columns["Id"].IsVisible = false; this.radGridView.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; var orderBiz = new OrderBiz(); GridViewTemplate template = new GridViewTemplate(); template.AutoGenerateColumns = true; template.AllowAddNewRow = false; template.AllowCellContextMenu = false; template.ReadOnly = true; template.DataSource = orderBiz.GetTemplateData(); this.radGridView.Templates.Add(template); template.Columns["OrderNo"].HeaderText = "Mã đơn hàng"; template.Columns["Status"].HeaderText = "Tình trạng"; template.Columns["Customer"].HeaderText = "Khách hàng"; template.Columns["DeliveryDate"].HeaderText = "Ngày giao"; template.Columns["DeliveryInternal"].HeaderText = "Hình thức vận chuyển"; template.Columns["SendMessage"].HeaderText = "Tin nhắn"; template.Columns["SendEmail"].HeaderText = "Email"; template.Columns["SendReport"].HeaderText = "Thông báo"; template.Columns["Id"].IsVisible = false; template.Columns["ParentId"].IsVisible = false; template.Columns["Recipient"].IsVisible = false; template.Columns["CustomerId"].IsVisible = false; template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewRelation relation = new GridViewRelation(radGridView.MasterTemplate, template); relation.RelationName = "SuppliersProducts"; relation.ParentColumnNames.Add("Id"); relation.ChildColumnNames.Add("ParentId"); this.radGridView.Relations.Add(relation); FormatCell(); } }
public void DeliverItem(object sender, EventArgs e) { if (selectedId > 0) { var biz = new OrderBiz(); biz.UpdateStatus(selectedId, Constants.OrderStatusDelivered); RefreshItems(sender, e); } }
public OrderView(User user) { InitializeComponent(); var biz = new OrderBiz(); radGridView.DataSource = biz.LoadItems(); radGridView.Refresh(); FormatCell(); currentUser = user; }
private void BindTableData() { IOrder orderBiz = new OrderBiz(); var dt = orderBiz.GetOrderData(OrderId); if (dt != null && dt.Rows.Count > 0) { var data1 = dt.Clone(); var drs = dt.Select(" ( FINISH_TIME = '' or FINISH_TIME is null ) and ( CONFIRM_TIME = '' or CONFIRM_TIME is null ) "); foreach (DataRow row in drs) { data1.Rows.Add(row.ItemArray); } this.rUnconfirm.DataSource = data1; this.rUnconfirm.DataBind(); var data2 = dt.Clone(); drs = dt.Select("( FINISH_TIME = '' or FINISH_TIME is null ) and ( CONFIRM_TIME <> '' and CONFIRM_TIME is not null ) "); foreach (DataRow row in drs) { data2.Rows.Add(row.ItemArray); } this.rConfirm.DataSource = data2; this.rConfirm.DataBind(); var data3 = dt.Clone(); drs = dt.Select(" FINISH_TIME <> '' and FINISH_TIME is not null "); foreach (DataRow row in drs) { data3.Rows.Add(row.ItemArray); } this.rFinish.DataSource = data3; this.rFinish.DataBind(); decimal totalPrice = 0; foreach (DataRow row in dt.Rows) { totalPrice += base.ParseDecimal(row["PRICE"].ToString()) * base.ParseInt(row["COUNT"].ToString()); } this.sTotalPrice.InnerText = totalPrice.ToString(); } else { this.rUnconfirm.DataSource = null; this.rUnconfirm.DataBind(); this.rConfirm.DataSource = null; this.rConfirm.DataBind(); this.rFinish.DataSource = null; this.rFinish.DataBind(); } }
public void ProcessRequest(HttpContext context) { try { var orderId = Helper.ParseInt(context.Request.Form["oid"]); IOrder orderBiz = new OrderBiz(); orderBiz.ClearCart(orderId); context.Response.Write("{\"success\":1}"); } catch (Exception ex) { context.Response.Write("{\"success\":0,\"msg\":\" " + ex.ToString() + " \"}"); } }
public JsonResult ChangeStatusReturn(string salesNo) { string res = "success"; try { OrderBiz.CreateNew().adminReturnProd(salesNo); } catch (Exception e) { res = "fail"; _Apilog.WriteLog("AdminController ChangeStatus 异常:" + e.Message); } return(Json(res)); }
public JsonResult deliverProds(string salesNo, string expressNo) { string res = "success"; try { OrderBiz.CreateNew().deliverProds(salesNo, expressNo); } catch (Exception e) { res = "fail"; _Apilog.WriteLog("AdminController deliverProds 异常:" + e.Message); } return(Json(res)); }
public ActionResult OrderCalendar(int id = 0) { ViewBag.Index = id; var model = new WeekOrderModel(); var date = DateTime.Today.AddDays(id * 7); var menuBiz = new MenuBiz(); var menus = menuBiz.GetWeekMenu(date); var orderBiz = new OrderBiz(); var orders = orderBiz.GetWeekOrders(date, User.Identity.ToString()); model.Menus = menus; model.Orders = orders; return(View("~/Views/Orders/WeekOrders.cshtml", model)); }
public void DeleteSingleItem(object sender, EventArgs e) { if (selectedId > 0) { var biz = new OrderBiz(); if (biz.IsDependent(selectedId)) { MessageBox.Show(Constants.Messages.DependentOrderMessage); } else { biz.RemoveSingleItem(selectedId); RefreshItems(sender, e); } } }
public void ProcessRequest(HttpContext context) { var orderId = Helper.ParseInt(context.Request.Form["oid"]); IOrder orderBiz = new OrderBiz(); var dt = orderBiz.GetOrderData(orderId); if (dt != null && dt.Rows.Count > 0) { var result = JsonHelper.DataTableToJson(dt); context.Response.Write(result); } else { context.Response.Write("{}"); } }
private void BindData() { //绑定菜单列表 IFood foodBiz = new FoodBiz(); var dt = foodBiz.GetFoodDataTable(RestaurantId); repeater2.DataSource = dt; repeater2.DataBind(); //绑定菜单类型列表 var strFoodId = string.Empty; var listFoodType = new List <FoodTypeEntity>(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { if (!strFoodId.Contains(dr["FOOD_TYPE_ID"].ToString() + "|")) { strFoodId += dr["FOOD_TYPE_ID"].ToString() + "|"; listFoodType.Add(new FoodTypeEntity() { FOOD_TYPE_ID = base.ParseInt(dr["FOOD_TYPE_ID"].ToString()), FOOD_TYPE_NAME = dr["FOOD_TYPE_NAME"].ToString() }); } } } repeater1.DataSource = listFoodType; repeater1.DataBind(); //获取是否已经点过菜 IOrder orderBiz = new OrderBiz(); var condition = new OrderMainEntity(); condition.RESTAURANT_ID = RestaurantId; condition.TABLE_ID = TableId; condition.ORDER_FLAG = "1"; var list = orderBiz.GetOrderMainEntityList(condition); if (list != null && list.Count > 0) { this.hOrderId.Value = list[0].ORDER_ID.ToString(); } }
public JsonResult CreateOrderFromShopcart(string prodIds) { string userOpenId = base.getUserOpenIdFromCookie(); string res = "fail"; if (!string.IsNullOrEmpty(userOpenId)) { try { //订单付款页面用户回退购物车页面,然后再创单时实际没有商品,规避此类垃圾数据 string[] prods = prodIds.Split(','); bool prodExist = false; for (int i = 0; i < prods.Length; i++) { shoppingcart checkResult = ShopCartBiz.CreateNew().checkProdExistInCarts(userOpenId, prods[i]); if (checkResult != null) { prodExist = true; break; } } if (prodExist) { string salesNo = WxPayApi.GenerateOutTradeNo();// Guid.NewGuid().ToString(); OrderBiz.CreateNew().createOrderFromShopcart(prodIds, userOpenId, salesNo); res = salesNo; } else { res = "noProds"; } } catch (Exception e) { res = "fail"; _Apilog.WriteLog("ProductsController/CreateOrderFromShopcart 异常: " + e.Message); } } else { _Apilog.WriteLog("ProductsController/CreateOrderFromShopcart 用户userOpenId 为空: " + prodIds); } return(Json(res)); }
/// <summary> /// 订单管理页面 /// </summary> /// <param name="status"></param> /// <returns></returns> public ActionResult order(string orderNo, string createDate, string receiver, string expressNo, string status) { List <GanXian.Model.UserOrderListInfo> userOrderList = new List <GanXian.Model.UserOrderListInfo>(); try { salesslip slipCondition = new salesslip(); if (!string.IsNullOrEmpty(status) && status.ToLower() != "all") { slipCondition.status = Convert.ToInt32(status); } if (!string.IsNullOrEmpty(orderNo)) { slipCondition.salesNo = orderNo.ToLower(); } if (!string.IsNullOrEmpty(receiver)) { slipCondition.receiver = receiver.ToLower(); } if (!string.IsNullOrEmpty(expressNo)) { slipCondition.expressNo = expressNo.ToLower(); } if (!string.IsNullOrEmpty(createDate)) { slipCondition.createDate = Convert.ToDateTime(createDate); } userOrderList = OrderBiz.CreateNew().getOrderListInfoByCondition(slipCondition); } catch (Exception e) { _Apilog.WriteLog("AdminController order 异常:" + e.Message); } ViewBag.status = status; ViewBag.orderNo = orderNo; ViewBag.createDate = createDate; ViewBag.receiver = receiver; ViewBag.expressNo = expressNo; ViewBag.ProjectUrl = System.Configuration.ConfigurationSettings.AppSettings["projectUrl"]; return(View(userOrderList)); }
public void ProcessRequest(HttpContext context) { try { var orderId = Helper.ParseInt(context.Request.Form["oid"]); var orderData = context.Request.Form["orderData"]; var foodOp = context.Request.Form["fop"]; var price = Helper.ParseDecimal(context.Request.Form["price"]); var entity = JsonToObject(orderData); IOrder orderBiz = new OrderBiz(); orderBiz.UpdateOrder(orderId, price, foodOp, entity); context.Response.Write("{\"success\":1}"); } catch (Exception ex) { context.Response.Write("{\"success\":0,\"msg\":\" " + ex.ToString() + " \"}"); } }
public JsonResult deleteOrder(string orderId) { string res = "fail"; string userOpenId = base.getUserOpenIdFromCookie(); if (!string.IsNullOrEmpty(userOpenId)) { try { res = "success"; OrderBiz.CreateNew().delOrder(userOpenId, orderId); } catch (Exception e) { res = "fail"; _Apilog.WriteLog("OrderController/deleteOrder 异常: " + e.Message); } } return(Json(res)); }
private bool CheckSecurity(int id) { if (id == 0) { return(false); } var biz = new OrderBiz(); var current = biz.LoadItem(id); if (current != null) { if (current.Modified.Value != modified.Value) { MessageBox.Show(Constants.Messages.ConflictOrderMessage); return(true); } } return(false); }
public void SendNotification(object sender, EventArgs e) { if (selectedId > 0) { if (selectedRow >= 0) { radGridView.Rows[selectedRow].Cells[5].Value = "Đang gửi"; radGridView.Refresh(); } var biz = new OrderBiz(); var status = biz.SendReport(selectedId); if (!string.IsNullOrEmpty(status.Error)) { MessageBox.Show(status.Error); } biz.UpdateNotificationStatus(selectedId, status.Status); RefreshItems(sender, e); } }
public JsonResult ChangePrice(string type, string salesNo, decimal price) { string res = "success"; try { if (type == "changeAmount") { OrderBiz.CreateNew().adminChangeAmount(salesNo, price); } else if (type == "changeExpress") { OrderBiz.CreateNew().adminChangePostage(salesNo, price); } } catch (Exception e) { res = "fail"; _Apilog.WriteLog("AdminController ChangePrice 异常:" + e.Message); } return(Json(res)); }
private void Search(object sender, EventArgs e) { DateTime?date = null; int? month = null; int? customerId = null; string value = Convert.ToString(drlMonth.SelectedItem); if (!string.IsNullOrEmpty(value)) { month = int.Parse(value); } if (drlCustomer.SelectedItem != null && Convert.ToInt32(drlCustomer.SelectedValue) > 0) { customerId = Convert.ToInt32(Convert.ToString(drlCustomer.SelectedValue)); } if (cboOrderDate.Checked) { date = dateOrderDate.Value; } var biz = new OrderBiz(); var data = biz.SearchOrder(date, month, customerId); foreach (var p in ListSelectedOrder) { var item = data.Find(i => i.Id == p.Id); if (item != null) { data.Remove(item); } } dataGridView.DataSource = data; }
private void Search(object sender, EventArgs e) { DateTime? date = null; int? month = null; int? customerId = null; string value = Convert.ToString(drlMonth.SelectedItem); if (!string.IsNullOrEmpty(value)) { month = int.Parse(value); } if (drlCustomer.SelectedItem != null && Convert.ToInt32(drlCustomer.SelectedValue) > 0) { customerId = Convert.ToInt32(Convert.ToString(drlCustomer.SelectedValue)); } if (cboOrderDate.Checked) { date = dateOrderDate.Value; } var biz = new OrderBiz(); var data = biz.SearchOrder(date, month, customerId); foreach (var p in ListSelectedOrder) { var item = data.Find(i => i.Id == p.Id); if (item != null) { data.Remove(item); } } dataGridView.DataSource = data; }
private void WorkAsync(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; if (flagSendMailOrder) { var biz = new OrderBiz(); var status = biz.SendEmail(Convert.ToInt32(e.Argument), currentUser.FullName); if (!string.IsNullOrEmpty(status.Error)) { MessageBox.Show(status.Error); } biz.UpdateEmailStatus(Convert.ToInt32(e.Argument), status.Status); } if (flagSendSmsOrder) { var biz = new OrderBiz(); string content = biz.GetSmsContent(Convert.ToInt32(e.Argument)); var result = MessageBox.Show(content, string.Empty, MessageBoxButtons.OKCancel); if(result == System.Windows.Forms.DialogResult.OK) { var status = biz.SendSms(Convert.ToInt32(e.Argument), currentUser.FullName); if (!string.IsNullOrEmpty(status.Error)) { MessageBox.Show(status.Error); } biz.UpdateSmsStatus(Convert.ToInt32(e.Argument), status.Status); } } if (flagSendSmsNotification) { var biz = new OrderBiz(); string content = biz.GetContentReport(Convert.ToInt32(e.Argument)); var result = MessageBox.Show(content, string.Empty, MessageBoxButtons.OKCancel); if (result == System.Windows.Forms.DialogResult.OK) { var status = biz.SendReport(Convert.ToInt32(e.Argument)); if (!string.IsNullOrEmpty(status.Error)) { MessageBox.Show(status.Error); } biz.UpdateNotificationStatus(Convert.ToInt32(e.Argument), status.Status); } } if (flagSendMail) { var biz = new DeliveryBiz(); var status = biz.SendEmail(Convert.ToInt32(e.Argument), currentUser.FullName); if (!string.IsNullOrEmpty(status.Error)) { MessageBox.Show(status.Error); } } if (flagSendSms) { var biz = new DeliveryBiz(); var status = biz.SendSms(Convert.ToInt32(e.Argument), currentUser.FullName); if (!string.IsNullOrEmpty(status.Error)) { MessageBox.Show(status.Error); } } }
public Handler(IUnitOfWork unitofWork) { _orderBiz = new OrderBiz(unitofWork); }
private void SaveItem(object sender, EventArgs e) { if (CheckSecurity(itemId)) { var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var orderView = new OrderView(currentUser) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(orderView); orderView.Show(); this.Close(); } else { if (CustomValidation()) { var item = new Order(); item.OrderDate = dateOrderDate.Value; item.DeliveryDate = dateDeliveryDate.Value; item.DeliveryAddress = textDeliverrAddress.Text; if (currentCustomer != null) { item.CustomerId = currentCustomer.Id; } item.DeliveryInternal = cboDeliveryInternal.Checked; //decimal discount = 0; //if (decimal.TryParse(txtDiscount.Text, out discount)) //{ // item.Discount = discount; //} //decimal discountLd = 0; //if (decimal.TryParse(txtDiscountLD.Text, out discountLd)) //{ // item.DiscountLD = discountLd; //} item.Recipient = txtRecipient.Text; item.RecipientPhone = txtRecipientPhone.Text; item.Vat = cboVat.Checked; if (!string.IsNullOrEmpty(item.Recipient) && string.IsNullOrEmpty(item.IsSendNotification)) { item.IsSendNotification = Constants.OrderReport1; } item.SendWithEmail = cboSendWithEmail.Checked; if(!string.IsNullOrEmpty(textDuNo.Text)) { item.Liability = decimal.Parse(textDuNo.Text); } item.SendEmail = sendEmail; item.SendMessage = sendSms; if (itemId > 0) { item.Id = itemId; item.Status = labelStatus.Text; item.OrderNo = labelOrderNo.Text; item.Created = created; item.CreatedByUserId = createdBy; item.Modified = DateTime.Now; item.ModifiedByUserId = currentUser.Id; var biz = new OrderBiz(); biz.UpdateItem(item); } else { item.Status = Constants.OrderStatusDraft; item.SendEmail = Constants.OrderEmail1; item.SendMessage = Constants.OrderSms1; item.Created = DateTime.Now; item.CreatedByUserId = currentUser.Id; item.Modified = DateTime.Now; item.ModifiedByUserId = currentUser.Id; var biz = new OrderBiz(); biz.SaveItem(item); } UpdateProductList(item); var parent = this.Parent as SplitterPanel; parent.Controls.Clear(); var orderView = new OrderView(currentUser) { Dock = DockStyle.Fill, TopLevel = false }; parent.Controls.Add(orderView); orderView.Show(); this.Close(); } else { this.DialogResult = DialogResult.None; } } }
public OrderForm(int id, User user) { InitializeComponent(); InitForm(user); var lockBiz = new LockingBiz(); var lockItem = lockBiz.LoadItem(Constants.TableNameOrder, user.Id, id); if (lockItem == null) { lockBiz.LockItem(Constants.TableNameOrder, id, user.Id); } else { groupBox1.Enabled = false; groupBox2.Enabled = false; groupBox3.Enabled = false; groupBox5.Enabled = false; groupBox7.Enabled = false; buttonSave.Enabled = false; var userBiz = new UserBiz(); var lockedUser = userBiz.LoadItem(lockItem.CurrentUserId); lockedUserName = lockedUser.FullName; isLocked = true; } itemId = id; var biz = new OrderBiz(); var item = biz.LoadItem(id); created = item.Created; createdBy = item.CreatedByUserId; modified = item.Modified; modifiedBy = item.ModifiedByUserId; labelOrderNo.Text = item.OrderNo; labelStatus.Text = item.Status; dateOrderDate.Value = item.OrderDate; dateDeliveryDate.Value = item.DeliveryDate; textDeliverrAddress.Text = item.DeliveryAddress; txtDiscount.Text = item.Discount.ToString(); txtDiscountLD.Text = item.DiscountLD.ToString(); if (item.Liability.HasValue) { textDuNo.Text = item.Liability.Value.ToString(Constants.CurrencyFormat); } txtRecipient.Text = item.Recipient; txtRecipientPhone.Text = item.RecipientPhone; cboDeliveryInternal.Checked = item.DeliveryInternal; cboVat.Checked = item.Vat; cboSendWithEmail.Checked = item.SendWithEmail; sendEmail = item.SendEmail; sendSms = item.SendMessage; if (item.CustomerId.HasValue) { textCustomer.Text = item.CustomerName; currentCustomer = item.Customer; SelectCustomer(); } LoadProducts(item); this.Text = "Sửa đơn hàng"; }
private bool CheckSecurity(int id) { if (id == 0) return false; var biz = new OrderBiz(); var current = biz.LoadItem(id); if(current != null) { if(current.Modified.Value != modified.Value) { MessageBox.Show(Constants.Messages.ConflictOrderMessage); return true; } } return false; }