public OrderDetailForm(int orderId = 0) { _orderId = orderId; InitializeComponent(); _orderDetailManager = OrderDetailManager.CreateAsSingleton(PathHelper.OrderDetailPathModel); _itemManager = ItemManager.CreateAsSingleton(PathHelper.ItemPathModel); }
public void GetAll_AllOrderDetailsCanListed() { IOrderDetailService service = new OrderDetailManager(_mockOrderDetailDal.Object); List <OrderDetail> orderDetails = service.GetAll().Data; Assert.AreEqual(2, orderDetails.Count); }
private void InitData() { bool visible = false; if (OrderDetailID > 0) { OrderDetail oOrderDetail = OrderDetailManager.GetOrderDetailByID(OrderDetailID); if (oOrderDetail != null) { visible = true; this.ltrOrderDetailID.Text = oOrderDetail.OrderDetailID.ToSureString(); this.ltrOrderID.Text = oOrderDetail.OrderID.ToSureString(); this.ltrProductID.Text = oOrderDetail.ProductID.ToSureString(); this.ltrQuantity.Text = oOrderDetail.Quantity.ToSureString(); this.ltrTaxRate.Text = oOrderDetail.TaxRate.ToSureString(); this.ltrUnitPrice.Text = oOrderDetail.UnitPrice.ToSureString(); this.ltrDiscountAmount.Text = oOrderDetail.DiscountAmount.ToSureString(); this.ltrTotalPrice.Text = oOrderDetail.TotalPrice.ToSureString(); this.ltrFinalPrice.Text = oOrderDetail.FinalPrice.ToSureString(); this.ltrCurrencyID.Text = oOrderDetail.CurrencyID.ToSureString(); } } tblData.Visible = visible; if (!visible) { Warn(ResourceManager.GetResource("form.nodata")); } }
public IActionResult OrderDetailList() { // throw new NotImplementedException(); var value = OrderDetailManager.showOrderDetail(); return(View(value)); }
public string DeleteProduct(int orderId) { context = new ApplicationDbContext(); OrderManager ordm = new OrderManager(context); OrderDetailManager orderDetailManager = new OrderDetailManager(context); //Traemos el Id de la ORd var pr = ordm.GetById(orderId); var ordts = orderDetailManager.GetAll().Where(e => e.Order_Id == orderId); if (ordts != null) { return("Hola a todos"); } else { foreach (var od in ordts) { orderDetailManager.Remove(od); } } return("Hola a todos"); }
protected void Page_Load(object sender, EventArgs e) { // Traemos el contexto context = new ApplicationDbContext(); orderManager = new OrderManager(context); orderDetailManager = new OrderDetailManager(context); try { var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>(); var user = manager.FindById(User.Identity.GetUserId()); txtUsername.Text = user.Email; txtEmail.Text = user.Email; txtCity.Text = user.City; txtPostalAddress.Text = user.PostalAddress; txtPostalCode.Text = user.PostalCode.ToString(); if (user.PhoneNumber != null) { txtPhoneNumber.Text = user.PhoneNumber.ToString(); } else { txtPhoneNumber.Text = "sin telefono"; } var orders = orderManager .GetAll().Where(u => u.User_Id == user.Id); string formatlink = "<a href='/Client/OrdersFiles/OrderDetail.aspx?Id={0}'>{1}</a>"; foreach (var or in orders) { var row = new TableRow(); row.Cells.Add(new TableCell { Text = string.Format(formatlink, or.Id, or.Id.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(formatlink, or.Id, or.CreatedDateOrder.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(or.OrderStatus.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(formatlink, or.Id, "Ver") }); tbody.Controls.Add(row); } } catch { //TODO: error, no encontrado result.Text = "No se ha encontrado la incidencia indicada"; result.CssClass = "has-error"; } }
public CustomerMainForm(int customerId) { _customerId = customerId; InitializeComponent(); _itemManager = ItemManager.CreateAsSingleton(PathHelper.ItemPathModel); _orderDetailManager = OrderDetailManager.CreateAsSingleton(PathHelper.OrderDetailPathModel); _customerManager = CustomerManager.CreateAsSingleton(PathHelper.CustomerPathModel); _orderManager = OrderManager.CreateAsSingleton(PathHelper.OrderPathModel); }
public void Setup() { manager = new OrderDetailManager(); orderDetail1 = new OrderDetail { name = "", quantity = 2, ProductID = 13, OrderID = 5 }; orderDetail2 = new OrderDetail { name = "", quantity = 3, ProductID = 10, OrderID = 3 }; manager.AddNew(orderDetail1); manager.AddNew(orderDetail2); }
protected void Page_Load(object sender, EventArgs e) { context = new ApplicationDbContext(); orderManager = new OrderManager(context); orderDetailManager = new OrderDetailManager(context); try { var idtext = Request.QueryString["Id"]; var orders = orderManager .GetAll() .Include(u => u.User) .Include(o => o.OrderDetails) .OrderByDescending(m => m.CreatedDateOrder); string formatlink = "<a href='OrderUpdate.aspx?Id={0}'>{1}</a>"; foreach (var or in orders) { var row = new TableRow(); row.Cells.Add(new TableCell { Text = string.Format(formatlink, or.Id, or.Id.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(formatlink, or.Id, or.CreatedDateOrder.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(or.OrderStatus.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(or.User.Email.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(formatlink, or.Id, "Ver/Editar") }); tbody.Controls.Add(row); } } catch { //TODO: error, no encontrado result.Text = "No se ha encontrado la incidencia indicada"; result.CssClass = "has-error"; } }
public Manager() { repo_category = new CategoryManager(); repo_email = new EmailManager(); repo_team = new TeamManager(); repo_product = new ProductManager(); repo_member = new MemberManager(); repo_order = new OrderManager(); repo_city = new CityManager(); repo_town = new TownManager(); repo_offer = new OfferManager(); repo_orderdetail = new OrderDetailManager(); }
public void Update_UpdateOrderDetail_ReturnTrueResult() { IOrderDetailService service = new OrderDetailManager(_mockOrderDetailDal.Object); OrderDetail orderDetail = new OrderDetail { Id = 3, OrderId = It.IsAny <int>(), ProductId = It.IsAny <int>(), Count = It.IsAny <int>(), SalePrice = It.IsAny <decimal>(), CreateDate = DateTime.Now, Active = true }; var result = service.Update(orderDetail); Assert.IsTrue(result.Success); }
private void InitData() { if (OrderDetailID > 0) { OrderDetail oOrderDetail = OrderDetailManager.GetOrderDetailByID(OrderDetailID); if (oOrderDetail != null) { this.ddlOrderID.Select(oOrderDetail.OrderID); this.ddlProductID.Select(oOrderDetail.ProductID); this.txtQuantity.ValueInt = oOrderDetail.Quantity; this.txtTaxRate.ValueInt = oOrderDetail.TaxRate; this.txtUnitPrice.ValueDecimal = oOrderDetail.UnitPrice; this.txtDiscountAmount.ValueDecimal = oOrderDetail.DiscountAmount; this.txtTotalPrice.ValueDecimal = oOrderDetail.TotalPrice; this.txtFinalPrice.ValueDecimal = oOrderDetail.FinalPrice; this.ddlCurrencyID.Select(oOrderDetail.CurrencyID); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } bool Updating = false; OrderDetail oOrderDetail = null; if (OrderDetailID > 0) { oOrderDetail = OrderDetailManager.GetOrderDetailByID(OrderDetailID); Updating = oOrderDetail != null; } if (!Updating) { oOrderDetail = new OrderDetail(); } oOrderDetail.OrderID = this.ddlOrderID.SelectedValue.ToInt(); oOrderDetail.ProductID = this.ddlProductID.SelectedValue.ToInt(); oOrderDetail.Quantity = this.txtQuantity.ValueInt; oOrderDetail.TaxRate = this.txtTaxRate.ValueByte; oOrderDetail.UnitPrice = this.txtUnitPrice.ValueDecimal; oOrderDetail.DiscountAmount = this.txtDiscountAmount.ValueDecimal; oOrderDetail.TotalPrice = this.txtTotalPrice.ValueDecimal; oOrderDetail.FinalPrice = this.txtFinalPrice.ValueDecimal; oOrderDetail.CurrencyID = this.ddlCurrencyID.SelectedValue.ToInt(); bool bSuccess = Updating ? OrderDetailManager.UpdateOrderDetail(oOrderDetail) : OrderDetailManager.InsertOrderDetail(oOrderDetail); if (bSuccess) { Redirect("/orderdetail-list?s=1"); } else { base.Warn("error.save"); } }
public OrderDetailService() : base(new OrderDetailManager()) { odm = manager as OrderDetailManager; }
private void LoadData() { OrderManager orderManager = new OrderManager(); OrderDetailManager orderDetailManager = new OrderDetailManager(); DataTable dtOrder = new DataTable("dtOrder"); DataTable dtOrderDetail = new DataTable("dtOrderDetail"); DataTable dt = new DataTable("dt"); try { if (Request.QueryString["id"] != null) { int orderId = int.Parse(Request.QueryString["id"].ToString()); dtOrder = orderManager.Order_GetList(orderId); if (dtOrder != null && dtOrder.Rows.Count > 0) { DataRow drOrder = dtOrder.Rows[0]; ddlAccountType.SelectedValue = drOrder["AccountTypeId"].ToString(); LoadAccount(int.Parse(ddlAccountType.SelectedValue)); txtOrderCode.Text = drOrder["OrderCode"].ToString(); ddlAccount.SelectedValue = drOrder["AccountId"].ToString(); txtTransportFee.Text = decimal.Parse(drOrder["TransportFee"].ToString()).ToString("#,##0"); txtNote.Text = drOrder["Note"].ToString(); dtOrderDetail = orderDetailManager.OrderDetail_GetList_OrderId(orderId); if (dtOrderDetail != null && dtOrderDetail.Rows.Count > 0) { dt = (DataTable)ViewState["dtOrderDetail"]; DataRow row; foreach (DataRow item in dtOrderDetail.Rows) { row = dt.NewRow(); row["ProductID"] = item["ProductID"]; row["Price"] = item["Price"]; row["Quantity"] = item["Quantity"]; row["Amount"] = item["Amount"]; row["UnitTypeId"] = item["UnitTypeId"]; row["UnitValue"] = item["UnitValue"]; row["UnitId"] = item["UnitId"]; dt.Rows.Add(row); } gvData.DataSource = dtOrderDetail; gvData.DataBind(); gvData.Visible = true; ErrorBox.Message = string.Empty; NotifyBox.Message = string.Empty; } else { gvData.Visible = false; ErrorBox.Message = "Không có dữ liệu"; NotifyBox.Message = string.Empty; } } else { ErrorBox.Message = "Không có dữ liệu"; NotifyBox.Message = string.Empty; } } else { ErrorBox.Message = "Không lấy được dữ liệu"; NotifyBox.Message = string.Empty; } } catch (Exception ex) { ErrorBox.Message = "Lỗi chức năng"; NotifyBox.Message = string.Empty; SaveErrorLog(ex); } }
private void LoadData() { OrderManager orderManager = new OrderManager(); OrderDetailManager orderDetailManager = new OrderDetailManager(); AccountManager accountManager = new AccountManager(); DataTable dtOrder = new DataTable(); DataTable dtOrderDetail = new DataTable(); try { if (Request.QueryString["id"] != null) { int orderId = int.Parse(Request.QueryString["id"].ToString()); dtOrder = orderManager.Order_GetList(orderId); if (dtOrder != null && dtOrder.Rows.Count > 0) { DataRow drOrder = dtOrder.Rows[0]; lblOrderType.Text = accountManager.OrderType_GetName(int.Parse(drOrder["AccountTypeId"].ToString())); lblAccountType.Text = accountManager.AccountType_GetName(int.Parse(drOrder["AccountTypeId"].ToString())); lblAccountName.Text = accountManager.Account_GetName(int.Parse(drOrder["AccountId"].ToString())); lblOrderCode.Text = drOrder["OrderCode"].ToString(); lblTransportFee.Text = decimal.Parse(drOrder["TransportFee"].ToString()).ToString("#,##0"); lblNote.Text = drOrder["Note"].ToString(); dtOrderDetail = orderDetailManager.OrderDetail_GetList_OrderId(orderId); if (dtOrderDetail != null && dtOrderDetail.Rows.Count > 0) { //add row SUM DataRow sumRow; sumRow = dtOrderDetail.NewRow(); sumRow["OrderId"] = -1; sumRow["OrderDetailId"] = -1; sumRow["ProductId"] = -1; sumRow["Price"] = -1; sumRow["Quantity"] = dtOrderDetail.Compute("SUM(Quantity)", null); sumRow["Amount"] = dtOrderDetail.Compute("SUM(Amount)", null); sumRow["UnitTypeId"] = -1; sumRow["UnitValue"] = -1; sumRow["UnitId"] = -1; dtOrderDetail.Rows.Add(sumRow); gvData.DataSource = dtOrderDetail; gvData.DataBind(); gvData.Visible = true; ErrorBox.Message = string.Empty; } else { gvData.Visible = false; ErrorBox.Message = "Không có dữ liệu"; } } else { ErrorBox.Message = "Không có dữ liệu"; } } else { ErrorBox.Message = "Không lấy được dữ liệu"; } } catch (Exception ex) { SaveErrorLog(ex); ErrorBox.Message = "Lỗi chức năng"; } }
public ItemForm() { InitializeComponent(); _itemManager = ItemManager.CreateAsSingleton(PathHelper.ItemPathModel); _orderDetailManager = OrderDetailManager.CreateAsSingleton(PathHelper.OrderDetailPathModel); }
protected void Page_Load(object sender, EventArgs e) { // Traemos el contexto context = new ApplicationDbContext(); orderManager = new OrderManager(context); orderDetailManager = new OrderDetailManager(context); productManager = new ProductManager(context); try { //Almacenamos en variables UserId y traemos los datos de usuario perteneciente al User string userId = HttpContext.Current.User.Identity.GetUserId(); var orders = orderManager.GetAll().Where(u => u.User_Id == userId).Include(sc => sc.User); //Datos de la orden var idtext = Int32.Parse(Request.QueryString["Id"]); var od = orderManager.GetById(new object[] { idtext }); txtOrderId.Text = od.Id.ToString(); txtCreateOrder.Text = od.CreatedDateOrder.ToString("dd/MM/yyyy"); txtOrderStatus.Text = od.OrderStatus.ToString(); ////datos de producto var orderId = od.Id; decimal su = 0; var ordts = orderDetailManager.GetAll().Where(u => u.Order_Id == orderId).Include(or => or.Order).Include(pr => pr.Product); var prodCarts = productManager.GetAll(); string formatlink = "<a href='ProductDtl.aspx?Id={0}'>{1}</a>"; foreach (var ord in ordts) { var row = new TableRow(); row.Cells.Add(new TableCell { Text = string.Format(formatlink, ord.Id, ord.Product.Id.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(formatlink, ord.Id, ord.Product.NameProduct.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(formatlink, ord.Id, ord.Product.Price.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(formatlink, ord.Id, ord.Quantity.ToString()) }); row.Cells.Add(new TableCell { Text = string.Format(formatlink, ord.Id, ord.Total.ToString()) }); tbody.Controls.Add(row); su += ord.Total; } //Sumamos el total de las celdas y mostramos como decimales string specifier = "F"; CultureInfo culture = CultureInfo.CreateSpecificCulture("fr-FR"); txtTotalismo.Text = su.ToString(specifier, culture); } catch { //TODO: error, no encontrado result.Text = "El carrito está vacio"; result.CssClass = "has-error"; } }
private void SaveData() { OrderBase orderBase = new OrderBase(); OrderManager orderManager = new OrderManager(); OrderDetailBase orderDetailBase = new OrderDetailBase(); OrderDetailManager orderDetailManager = new OrderDetailManager(); DataTable dtOrder = new DataTable("dtOrder"); DataTable dtOrderDetail = new DataTable("dtOrderDetail"); int code = -1, orderId = 0; string msg = ""; try { if (ViewState["dtOrderDetail"] != null) { orderBase.AccountTypeId = int.Parse(ddlAccountType.SelectedValue); orderBase.AccountId = int.Parse(ddlAccount.SelectedValue); orderBase.OrderCode = txtOrderCode.Text.Trim(); orderBase.TransportFee = decimal.Parse(txtTransportFee.Text.Trim().Replace(",", "")); orderBase.Note = txtNote.Text.Trim(); orderBase.CreateDate = DateTimeParse(txtCreateDate.Text.Trim()); orderBase.CreateUser = User.Identity.Name; orderManager.Order_Insert(orderBase, ref code, ref msg); SaveActionLog("Thêm mới Order", string.Format("code: {0}; msg: {1}", code, msg)); if (code == 0) { orderId = int.Parse(msg.Split(';')[1].ToString()); dtOrderDetail = (DataTable)ViewState["dtOrderDetail"]; foreach (DataRow item in dtOrderDetail.Rows) { orderDetailBase.OrderId = orderId; orderDetailBase.ProductId = int.Parse(item["ProductID"].ToString()); orderDetailBase.UnitTypeId = int.Parse(item["UnitTypeId"].ToString()); orderDetailBase.UnitId = int.Parse(item["UnitId"].ToString()); orderDetailBase.UnitValue = float.Parse(item["UnitValue"].ToString().Replace(",", "")); orderDetailBase.Quantity = int.Parse(item["Quantity"].ToString().Replace(",", "")); orderDetailBase.Price = decimal.Parse(item["Price"].ToString().Replace(",", "")); orderDetailBase.Amount = decimal.Parse(item["Amount"].ToString().Replace(",", "")); orderDetailManager.OrderDetail_Insert(orderDetailBase, ref code, ref msg); if (code != 0) { orderDetailManager.OrderDetail_Delete_OrderId(orderId, ref code, ref msg); orderManager.Order_Delete(orderId, ref code, ref msg); SaveActionLog("Xóa Order", string.Format("code: {0}; msg: {1}", code, msg)); ErrorBox.Message = "Lưu dữ liệu thất bại"; NotifyBox.Message = string.Empty; break; } } if (ErrorBox.Message != "Lưu dữ liệu thất bại") { ErrorBox.Message = string.Empty; NotifyBox.Message = "Lưu dữ liệu thành công"; } } else { ErrorBox.Message = "Lưu dữ liệu thất bại"; NotifyBox.Message = string.Empty; } } } catch (Exception ex) { if (orderId != 0) { orderDetailManager.OrderDetail_Delete_OrderId(orderId, ref code, ref msg); orderManager.Order_Delete(orderId, ref code, ref msg); } ErrorBox.Message = "Lỗi chức năng"; NotifyBox.Message = string.Empty; SaveErrorLog(ex); } }
protected void Page_Load(object sender, EventArgs e) { // Traemos el contexto context = new ApplicationDbContext(); orderManager = new OrderManager(context); orderDetailManager = new OrderDetailManager(context);
private void LoadData() { OrderManager orderManager = new OrderManager(); OrderDetailManager orderDetailManager = new OrderDetailManager(); AccountManager accountManager = new AccountManager(); DataTable dtOrder = new DataTable(); DataTable dtOrderDetail = new DataTable(); DataTable dtAccount = new DataTable(); decimal totalAmount = 0, totalQuanTity = 0; if (Request.QueryString["id"] != null) { int orderId = int.Parse(Request.QueryString["id"].ToString()); dtOrder = orderManager.Order_GetList(orderId); if (dtOrder != null && dtOrder.Rows.Count > 0) { DataRow drOrder = dtOrder.Rows[0]; int accountId = int.Parse(drOrder["AccountId"].ToString()); lblAccountName.Text = accountManager.Account_GetName(accountId); lblNote.Text = drOrder["Note"].ToString(); dtAccount = accountManager.Account_GetList(accountId); if (dtAccount != null && dtAccount.Rows.Count > 0) { lblAddress.Text = dtAccount.Rows[0]["Address"].ToString(); } dtOrderDetail = orderDetailManager.OrderDetail_GetList_OrderId(orderId); if (dtOrderDetail != null && dtOrderDetail.Rows.Count > 0) { foreach (DataRow row in dtOrderDetail.Rows) { totalQuanTity += decimal.Parse(row["Quantity"].ToString()); totalAmount += decimal.Parse(row["Amount"].ToString()); } //add row SUM DataRow sumRow; sumRow = dtOrderDetail.NewRow(); sumRow["OrderId"] = -1; sumRow["OrderDetailId"] = -1; sumRow["ProductId"] = -1; sumRow["Price"] = -1; sumRow["Quantity"] = totalQuanTity; sumRow["Amount"] = totalAmount; sumRow["UnitTypeId"] = -1; sumRow["UnitValue"] = -1; sumRow["UnitId"] = -1; dtOrderDetail.Rows.Add(sumRow); gvData.DataSource = dtOrderDetail; gvData.DataBind(); lblNumberWord.Text = MoneyToString(totalAmount); gvData.Visible = true; gvData.CssClass = gvData.CssClass.Replace("Label", ""); gvData.CssClass = gvData.CssClass.Replace("colunmHeader", ""); gvData.CssClass = gvData.CssClass.Replace("HlightRow", ""); gvData.CssClass = gvData.CssClass.Replace("Label", ""); } else { gvData.Visible = false; } } } }