public OrderInfoViewModel OrderInfo(int OrderID) { OrderInfoViewModel objInfo = new OrderInfoViewModel(); var cmd = context.Database.Connection.CreateCommand(); cmd.CommandText = "exec proc_OrderInfo '" + OrderID.ToString() + "'"; try { context.Database.Connection.Open(); // Run the sproc var reader = cmd.ExecuteReader(); // Read OrderDetail from the first result set objInfo.OrderDetail = ((IObjectContextAdapter)context) .ObjectContext .Translate <orderDetailModel>(reader).FirstOrDefault(); // Move to second result set and read inventory reader.NextResult(); objInfo.OrderItemDetail = ((IObjectContextAdapter)context) .ObjectContext .Translate <inventoryDetailsViewModel>(reader).ToList(); // Move to third result set and read BillingAddress reader.NextResult(); objInfo.BillingAddress = ((IObjectContextAdapter)context) .ObjectContext .Translate <MstBillingAddressViewModel>(reader).FirstOrDefault(); // Move to fourth result set and read OrderCharges reader.NextResult(); objInfo.Charges = ((IObjectContextAdapter)context) .ObjectContext .Translate <OrderChargesViewModel>(reader).ToList(); // Move to fifth result set and read OrderCharges reader.NextResult(); objInfo.UserDetail = ((IObjectContextAdapter)context) .ObjectContext .Translate <UserDetailModel>(reader).FirstOrDefault(); } finally { context.Database.Connection.Close(); } return(objInfo); }
public void SendForOrder(OrderInfoViewModel objOInfo, int CustomerId, string TemplatePath, string Message, bool SentToCustomer = false) { StringBuilder sbMailTemplate = new StringBuilder(); sbMailTemplate.Append(System.IO.File.ReadAllText(TemplatePath)); List<string> lstOfEmailIDs = new List<string>(); if (SentToCustomer && objOInfo != null && objOInfo.UserDetail != null) { lstOfEmailIDs.Add(objOInfo.UserDetail.emailId); } else { lstOfEmailIDs.Add(ConfigurationManager.AppSettings["Email_ID"].ToString()); lstOfEmailIDs.Add(ConfigurationManager.AppSettings["CCemail"].ToString()); } if (objOInfo != null && objOInfo.BillingAddress != null) { List<string> objLst = objOInfo.OrderItemDetail.Select(x => x.Stock).ToList(); string LotNos = "LOTNO~" + string.Join(",", objLst); DataTable dt = this.objStockDetailsService.GetDataForExcelExport(LotNos, false, CustomerId); if (dt.Columns.Count > 0) { dt.Columns.Remove("Weight"); if (SentToCustomer == true) { dt.Columns.Remove("SalesLocation"); } } DataTable dtOrderCharges = objOInfo.ConvertOrderChangesInDatetable(); string htmlTableForOrderDetail = CommonFunction.ConvertDataTableToHTML(dt, false, true); string htmlTableForOrderChargesDetail = CommonFunction.ConvertDataTableToHTML(dtOrderCharges, false, true); sbMailTemplate = sbMailTemplate.Replace("${CustomerName}", objOInfo.BillingAddress.firstName + " " + objOInfo.BillingAddress.lastName); sbMailTemplate = sbMailTemplate.Replace("${OrderNo}", objOInfo.OrderDetail.orderDetailsId.ToString()); sbMailTemplate = sbMailTemplate.Replace("${TABLEDATA}", htmlTableForOrderDetail); sbMailTemplate = sbMailTemplate.Replace("${TABLEDATAFORCHARGES}", htmlTableForOrderChargesDetail); sbMailTemplate = sbMailTemplate.Replace("${CompanyName}", objOInfo.BillingAddress.companyName); sbMailTemplate = sbMailTemplate.Replace("${Address}", objOInfo.BillingAddress.address01 + " " + objOInfo.BillingAddress.address02); sbMailTemplate = sbMailTemplate.Replace("${CountryName}", objOInfo.BillingAddress.countryName); sbMailTemplate = sbMailTemplate.Replace("${phoneCode01}", objOInfo.UserDetail.phoneCode01); sbMailTemplate = sbMailTemplate.Replace("${phone01}", objOInfo.UserDetail.phone01); sbMailTemplate = sbMailTemplate.Replace("${emailId}", objOInfo.UserDetail.emailId); sbMailTemplate = sbMailTemplate.Replace("${bankName}", objOInfo.UserDetail.bankName); sbMailTemplate = sbMailTemplate.Replace("${branchName}", objOInfo.UserDetail.branchName); sbMailTemplate = sbMailTemplate.Replace("${branchAddress}", objOInfo.UserDetail.branchAddress); sbMailTemplate = sbMailTemplate.Replace("${accNumber}", objOInfo.UserDetail.accNumber); sbMailTemplate = sbMailTemplate.Replace("${swiftCode}", objOInfo.UserDetail.swiftCode); if (this.objMU == null) { this.objMU = new MailUtility(); } objMU.SendMail(lstOfEmailIDs, "Customer order details @ www.rosyblueonline.com", true, sbMailTemplate.ToString()); } }
public virtual ActionResult GetAllUnshippedInfo() { //NOTE: Not USED, for future refactoring! LogI("GetAllUnshippedInfo"); var items = OrderInfoViewModel.GetAll(Db, LogService, WeightService, null); return(Json(ValueResult <IList <OrderInfoViewModel> > .Success("", items), JsonRequestBehavior.AllowGet)); }
public ActionResult OrderDetails(OrderInfoViewModel o) { if (ModelState.IsValid) { o.OrderInfo.ADMIN_ID = Convert.ToInt32(User.Identity.Name); if (db.AssignOrder(o.OrderInfo)) { return(RedirectToAction("Index")); } } return(HttpNotFound()); }
public async Task <ActionResult> Put(Guid id, [FromBody] OrderInfoViewModel model) { if (!this.ModelState.IsValid) { return(this.BadRequest()); } //await orderService.(model.OldName, model.NewName); return(this.Ok()); }
//release public ActionResult ReleaseDeclinedOrder(int teaid, int orderid) { booktrackingdbEntities db = new booktrackingdbEntities(); var model = new OrderInfoViewModel(); var selectedOrder = db.Orders.Where(x => x.OrderID == orderid).FirstOrDefault(); selectedOrder.Status = "Pending"; selectedOrder.OTeacherID = null; db.SaveChanges(); return(RedirectToAction("sendReleaseEmail", new { teaid = teaid, declinedReleased = "yes", orderid = orderid })); }
private void Adapt(Order fromValue, OrderInfoViewModel toValue) { toValue.Id = fromValue.Id; toValue.ShipToAddress = fromValue.ShipToAddress; toValue.ShipToCity = fromValue.ShipToCity; toValue.ShipToName = fromValue.ShipToName; toValue.ShipToPostalCode = fromValue.ShipToPostalCode; toValue.ShipToState = fromValue.ShipToState; toValue.ApprovedBy = fromValue.ApprovedBy; toValue.InternalOrderNumber = fromValue.InternalOrderNumber; toValue.ProfitAmount = fromValue.ProfitAmount; }
public ActionResult checkoutBook(int admid, int orderid) { booktrackingdbEntities db = new booktrackingdbEntities(); var model = new OrderInfoViewModel(); var selectedOrder = db.Orders.Where(x => x.OrderID == orderid).FirstOrDefault(); selectedOrder.Status = "Checked Out"; selectedOrder.OAdminID = admid; db.SaveChanges(); return(RedirectToAction("AdminHomePage", new { admid = admid, checkedOut = "yes" })); }
public ActionResult PartialSellMemo(int OrderID, string LotNos, int MemoMode, decimal salesAvgDiscount) { try { int RowCount = 0; int LoginID = GetLogin(); if (LoginID > 0) { OrderInfoViewModel objOVM = this.objMemoService.MemoInfo(OrderID); if (objOVM != null && objOVM.OrderDetail != null) { if (LotNos.Split(',').Count() == 0) { throw new Exception("No items selected"); } else if (objOVM.OrderItemDetail.Count == LotNos.Split(',').Count()) { RowCount = this.objMemoService.SellFullMemo(OrderID, LoginID, MemoMode, salesAvgDiscount); } else { int newOrderID = this.objMemoService.SplitMemo(OrderID, LotNos, LoginID, objOVM.OrderDetail.customerId, 0, 0, "Partial Sell"); if (newOrderID > 0) { RowCount = this.objMemoService.SellFullMemo(newOrderID, LoginID, MemoMode, salesAvgDiscount); } } if (objOVM != null && RowCount > 0) //Added By Ankit 08Jun2020--Suggested By LK { this.objMemoService.SendMailMemo(OrderID, GetEmailID(), GetFullName(), LoginID, "List of inventory sell partial memo to", "", Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["EmailTemplate_SellMemo"])); bool log = this.objUDSvc.UserActivitylogs(LoginID, "partial sell memo", LotNos); } } return(Json(new Response { Code = 200, IsSuccess = true, Message = "", Result = RowCount })); } return(Json(new Response { IsSuccess = false, Message = string.Format(StringResource.Invalid, "Session") })); } catch (Exception ex) { ErrorLog.Log("MemoController", "PartialSellMemo", ex); return(Json(new Response { IsSuccess = false, Message = ex.Message })); } }
//cancel public ActionResult CancelPending(int stuid, int bookid, int classid) { booktrackingdbEntities db = new booktrackingdbEntities(); var model = new OrderInfoViewModel(); model.stu_id = stuid; model.OrderID = db.Orders.Where(x => x.OStudentID == stuid && x.OBookID == bookid).Select(x => x.OrderID).FirstOrDefault(); db.Orders.Remove(db.Orders.Find(model.OrderID)); db.SaveChanges(); return(RedirectToAction("sendCancelEmail", new { stuid = model.stu_id, pendingCancelled = "yes", bookid = bookid, classid = classid })); }
public ActionResult PartialCancel(int OrderID, string LotNos, int FileNo = 0) { try { int LoginID = GetLogin(); if (LoginID > 0) { OrderInfoViewModel objInfo = this.objMemoService.MemoInfo(OrderID); MemoDetail obj = this.objMemoService.CancelPartialMemo(OrderID, LotNos, LoginID); if (FileNo != 0) { fileUploadLogModel objFile = this.objMemoService.GetFileByID(FileNo); if (objFile != null) { String path = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["INVUpload"]); DataTable dtValid = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "Valid").ToList()); DataTable dtNotValid = ListtoDataTable.ToDataTable <InventoryUpload>(obj.Inv.Where(x => x.LotStatus == "InValid").ToList()); ExportToExcel.SaveExcel(path, FileNo.ToString() + "_Valid", "Valid", dtValid); ExportToExcel.SaveExcel(path, FileNo.ToString() + "_InValid", "InValid", dtNotValid); objFile.validInv = obj.Inv.Where(x => x.LotStatus == "Valid").Count(); objFile.invalidInv = obj.Inv.Where(x => x.LotStatus == "InValid").Count(); this.objMemoService.UpdateFile(objFile); if (obj.Counts.OrderId > 0) { this.objMemoService.UpdateFile(obj.Counts.OrderId, FileNo); } } } if (objInfo != null && obj.Counts != null && obj.Counts.OrderId > 0) { this.objMemoService.SendMailMemo(obj.Counts.OrderId, GetEmailID(), GetFullName(), objInfo.UserDetail.loginID, "List of inventory Partial Canceled Memo from memo-", "", Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["EmailTemplate_CancelMemo"]), objInfo, LotNos); bool log = this.objUDSvc.UserActivitylogs(LoginID, "Partial canceled memo", LotNos); } return(Json(new Response { Code = 200, IsSuccess = true, Message = "", Result = obj.Counts.validCount })); } return(Json(new Response { IsSuccess = false, Message = string.Format(StringResource.Invalid, "Session") })); } catch (Exception ex) { ErrorLog.Log("MemoController", "PartialCancel", ex); return(Json(new Response { IsSuccess = false, Message = ex.Message })); } }
public ActionResult viewHistory(int admid) { booktrackingdbEntities db = new booktrackingdbEntities(); var model = new OrderInfoViewModel(); model.adm_id = admid; model.OrderListing = db.Orders.Where(x => x.Status == "Returned").ToList(); model.StudentListing = db.Students.ToList(); model.TeacherListing = db.Teachers.ToList(); model.AdminListing = db.Admins.ToList(); model.BookListing = db.Books.ToList(); return(View(model)); }
public ActionResult OrderDetails(int?orderid) { OrderInfoViewModel o = new OrderInfoViewModel(); o.Companies = db.GetCompanies(); if (orderid.HasValue) { o.OrderInfo = db.GetOrderInfo((int)orderid); } else { RedirectToAction("Orders"); } o.Order = db.GetOrderById((int)orderid)[0]; o.Artwork = db.GetArtworkWithCode(o.OrderInfo.AW_CODE); return(View(o)); }
public JsonResult GetInfo(int OrderID) { try { OrderInfoViewModel obj = this.objOrderService.OrderInfo(OrderID); return(Json(new Response { IsSuccess = true, Message = "", Result = obj })); } catch (Exception ex) { ErrorLog.Log("OrderController", "GetInfo", ex); return(Json(new Response { IsSuccess = false, Message = ex.Message })); } }
public IActionResult GetOrder(int id) { Order order = _orderService.GetOrder(id); OrderInfoViewModel orderVM = _mapper.Map <OrderInfoViewModel>(order); if (order != null) { return(new JsonResult(orderVM) { StatusCode = StatusCodes.Status200OK }); } return(new JsonResult(orderVM) { StatusCode = StatusCodes.Status409Conflict }); }
//approve public ActionResult ApprovePending(int teaid, int orderid) { booktrackingdbEntities db = new booktrackingdbEntities(); var model = new OrderInfoViewModel(); var selectedOrder = db.Orders.Where(x => x.OrderID == orderid).FirstOrDefault(); selectedOrder.Status = "Approved"; selectedOrder.OTeacherID = teaid; selectedOrder.DueDate = DateTime.Now.AddDays(7);; var selectedBook = db.Books.Where(x => x.BookID == selectedOrder.OBookID).FirstOrDefault(); selectedBook.Quantity--; db.SaveChanges(); return(RedirectToAction("sendApproveEmail", new { teaid = teaid, requestApproved = "yes", orderid = orderid })); }
public ActionResult returnBook(int admid, int orderid) { booktrackingdbEntities db = new booktrackingdbEntities(); var model = new OrderInfoViewModel(); var selectedOrder = db.Orders.Where(x => x.OrderID == orderid).FirstOrDefault(); selectedOrder.Status = "Returned"; selectedOrder.OAdminID = admid; selectedOrder.Balance = null; selectedOrder.ReturnDate = DateTime.Now; var selectedBook = db.Books.Where(x => x.BookID == selectedOrder.OBookID).FirstOrDefault(); selectedBook.Quantity++; db.SaveChanges(); return(RedirectToAction("AdminHomePage", new { admid = admid, returned = "yes" })); }
public async Task <bool> SaveOrder(OrderInfoViewModel orderInfoViewModel) { if (orderInfoViewModel == null) { return(false); } // Delete all reserved stocks since we made the order var reservedStocks = applicationDbContext.stocksReservedOnOrder .Where(x => x.SessionId == orderInfoViewModel.SessionId) .AsEnumerable(); applicationDbContext.stocksReservedOnOrder.RemoveRange(reservedStocks); Order order = new Order { AddressPrimary = orderInfoViewModel.AddressPrimary, AddressSecondary = orderInfoViewModel.AddressSecondary, City = orderInfoViewModel.City, ClientId = orderInfoViewModel.ClientId, Country = orderInfoViewModel.Country, EmailCustomer = orderInfoViewModel.EmailCustomer, FirstNameCustomer = orderInfoViewModel.FirstNameCustomer, LastNameCustomer = orderInfoViewModel.LastNameCustomer, OrderBuyerComment = orderInfoViewModel.OrderBuyerComment, PostCode = orderInfoViewModel.PostCode, StripeRef = orderInfoViewModel.StripeOrderRef, OrderDate = DateTime.Now, OrderStatus = "Waiting", OrderStocks = orderInfoViewModel.Stocks.Select(x => new OrderStock { StockId = x.StockId, Quantity = x.Quantity }).ToList(), OrderUniqueId = GenerateOrderUniqueId(DateTime.Now.ToString("dd:mm")) }; applicationDbContext.Orders.Add(order); var res = await applicationDbContext.SaveChangesAsync(); return(true); }
/// <summary> /// 显示订单详情窗口 /// </summary> /// <param name="orderId">订单对象</param> /// <param name="call"></param> /// <param name="flag"></param> internal static void ShowOrderInfo(string orderId, Action <bool?> call, int flag = 0) { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { var vm = new OrderInfoViewModel { OrderId = orderId }; vm.Initialize(); var window = new OrderInfoWindow(flag) { Owner = Application.Current.MainWindow, DataContext = vm }; var result = window.ShowDialog(); if (call != null) { call(result); } window.DataContext = null; })); }
public ActionResult SplitMemo(int OrderID, string LotNos, int CustomerID, int isConfirmed, int isSellDirect, string Remark, int FileNo = 0) { try { int LoginID = GetLogin(); if (LoginID > 0) { OrderInfoViewModel objInfo = this.objMemoService.MemoInfo(OrderID); int RowCount = this.objMemoService.SplitMemo(OrderID, LotNos, LoginID, CustomerID, isConfirmed, isSellDirect, Remark); if (FileNo != 0) { fileUploadLogModel objFile = this.objMemoService.GetFileByID(FileNo); objFile.validInv = LotNos.Split(',').Length; objFile.invalidInv = 0; this.objMemoService.UpdateFile(objFile); } if (objInfo != null && RowCount > 0) { this.objMemoService.SendMailMemo(RowCount, GetEmailID(), GetFullName(), objInfo.UserDetail.loginID, "List of inventory SplitMemo from memo-", "", Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["EmailTemplate_SplitMemo"])); bool log = this.objUDSvc.UserActivitylogs(LoginID, "Split memo", LotNos); } return(Json(new Response { Code = 200, IsSuccess = true, Message = "", Result = RowCount })); } return(Json(new Response { IsSuccess = false, Message = string.Format(StringResource.Invalid, "Session") })); } catch (Exception ex) { ErrorLog.Log("MemoController", "PartialCancel", ex); return(Json(new Response { IsSuccess = false, Message = ex.Message })); } }
// print billing info public IActionResult PrintBillingInfo(int infoId) { var employeeDataString = HttpContext.Session.GetString("employee"); if (employeeDataString == "") { return(RedirectToAction("Login", "Auth")); } else { Employee employee = JsonConvert.DeserializeObject <Employee>(employeeDataString); if (userAccessManager.IsAccessExists(employee.Id, 5)) { OrderInfoViewModel orderInfo = orderManager.GetOrderDetailsByInfoId(infoId); if (orderInfo != null) { return(new ViewAsPdf("PrintBillingInfo", orderInfo) { FileName = orderInfo.FirstName + "-" + orderInfo.LastName + "'s_Bill.pdf", PageOrientation = Orientation.Portrait, PageSize = Size.A4 }); } else { return(NotFound("404- Not Found")); } } else { return(NotFound("No Access")); } } }
public async Task <ActionResult> NewOrder(OrderInfoViewModel model, int shippingId, int payingId) { _userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var user = await _context.Users.FirstOrDefaultAsync(d => d.Id == _userId); var products = _context.Products.ToList(); var totalPrice = 0.0; var flag = false; string error = null; if (!await _context.PayingShippingMethods.AnyAsync(d => d.PayingMethodId == payingId && d.ShippingMethodId == shippingId)) { return(NotFound()); } var productsInShoppingCart = _context.ShoppingCarts .Include(d => d.Product).Include(d => d.HotShot).Where(d => d.IdentityUserId == _userId).ToList(); var hotShot = await _context.HotShots.Include(d => d.Product.Gallery.ImageGalleries) .ThenInclude(d => d.Image) .FirstOrDefaultAsync(d => d.StartDate <DateTime.Now && d.EndDate> DateTime.Now); if (productsInShoppingCart.Any(d => d.HotShotId != null)) { if (_context.AccountHotShots.Where(d => d.IdentityUserId == _userId).Any(d => d.HotShotId == hotShot.HotShotId.ToString())) { flag = true; error = AppErrorMessage.HotShotAlreadyBought; } if (hotShot.HasEnded || hotShot.Quantity <= hotShot.ItemsSold) { _context.ShoppingCarts.RemoveRange(productsInShoppingCart.Where(d => d.HotShotId != null)); error = AppErrorMessage.SaleHasEnded; flag = true; } } if (productsInShoppingCart.Any(d => d.Product.IsActive == false)) { _context.ShoppingCarts.RemoveRange(productsInShoppingCart.Where(d => d.Product.IsActive == false)); error = AppErrorMessage.ProductsDeletedFormCart; flag = true; } if (flag) { await _context.SaveChangesAsync(); return(RedirectToAction("Index", "ShoppingCart", new { error = error })); } var hasAddress = await _context.Addresses.AnyAsync(d => d.IdentityUserId == _userId); if (!hasAddress) { model.Address.IdentityUserId = _userId; await _context.Addresses.AddAsync(model.Address); await _context.SaveChangesAsync(); } foreach (var product in productsInShoppingCart) { var price = product.Product.Price; if (product.HotShotId != null) { price = hotShot.NewPrice; } totalPrice += product.Quantity * price; } await using (_context) { await using (var transaction = _context.Database.BeginTransaction()) { var address = await _context.Addresses .FirstOrDefaultAsync(d => d.IdentityUserId == _userId); var order = new Order() { IdentityUserId = _userId, OrderDate = DateTime.Now, TotalPrice = totalPrice, OrderStatus = OrderStatus.Created, AddressId = address.AddressId, ShippingMethod = await _context.ShippingMethods.FirstOrDefaultAsync(d => d.ShippingMethodId == shippingId), PayingMethod = await _context.PayingMethods.FirstOrDefaultAsync(d => d.PayingMethodId == payingId) }; await _context.Orders.AddAsync(order); await _context.SaveChangesAsync(); var orderDetailsList = new List <OrderDetails>(); foreach (var shoppingCart in productsInShoppingCart) { double price = shoppingCart.Product.Price; if (shoppingCart.HotShotId != null) { price = shoppingCart.HotShot.NewPrice; } var orderDetails = new OrderDetails() { OrderId = order.OrderId, ProductId = shoppingCart.ProductId, PricePerItem = price, Quantity = shoppingCart.Quantity }; if (shoppingCart.HotShotId != null) { hotShot.ItemsSold += shoppingCart.Quantity; _context.AccountHotShots.Add(new AccountHotShot() { HotShotId = hotShot.HotShotId.ToString(), IdentityUserId = _userId }); } var product = products.First(d => d.ProductId == shoppingCart.ProductId); product.QuantityInStock -= shoppingCart.Quantity; orderDetailsList.Add(orderDetails); } await _context.OrderDetails.AddRangeAsync(orderDetailsList); await _context.SaveChangesAsync(); foreach (var orderDetails in orderDetailsList) { _context.OrderDetailsOrders.Add(new OrderDetailsOrder() { OrderId = order.OrderId, OrderDetailsId = orderDetails.OrderDetailsId }); } await _context.SaveChangesAsync(); _context.ShoppingCarts.RemoveRange(productsInShoppingCart); await _context.SaveChangesAsync(); await transaction.CommitAsync(); _emailManager.SendEmail(user.Email, "Zamówienie zostało złożone", EmailMessage.OrderCreated); } } return(RedirectToAction("Index", "Home")); }
public void SendMailMemo(int OrderID, string UserEmailID, string ToName, int CustomerId, string Subject, string MessageContent, string TemplatePath, OrderInfoViewModel objOInfo = null, string OLotNos = null, int MemoMode = 1, decimal salesAvgDiscount = 0) { StringBuilder sbMailTemplate = new StringBuilder(); sbMailTemplate.Append(System.IO.File.ReadAllText(TemplatePath)); if (objOInfo == null) { objOInfo = this.objOrdSvc.OrderInfo(OrderID); } List <string> lstOfEmailIDs = new List <string>(); //List<string> lstOfEmailIDCCs = new List<string>(); string EmailIDsInCC = string.Empty; EmailIDsInCC = ((ConfigurationManager.AppSettings["CCemail"].ToString())); if (!string.IsNullOrEmpty(UserEmailID)) { lstOfEmailIDs.Add(UserEmailID); } if (objOInfo != null && objOInfo.BillingAddress != null) { //OrderInfoViewModel objOInfo = OrderInfo(OrderID); string LotNos = ""; if (OLotNos != null) { LotNos = "LOTNO~" + OLotNos; } else { List <string> objLst = objOInfo.OrderItemDetail.Select(x => x.Stock).ToList(); LotNos = "LOTNO~" + string.Join(",", objLst); } //6 login id of shanay meheta DataTable dt = MemoMode == 1 ? this.objStockDetailsService.GetDataForExcelExport2(LotNos, false, 6) : this.objStockDetailsService.GetDataForExcelExport3(OrderID, 6, salesAvgDiscount); //DataTable dt = this.objStockDetailsService.GetDataForExcelExport(LotNos, false, CustomerId); string htmlTableForOrderDetail = CommonFunction.ConvertDataTableToHTML(dt, false, true); sbMailTemplate = sbMailTemplate.Replace("${UserName}", ToName); sbMailTemplate = sbMailTemplate.Replace("${CustomerName}", objOInfo.BillingAddress.firstName + " " + objOInfo.BillingAddress.lastName); sbMailTemplate = sbMailTemplate.Replace("${OrderNo}", OrderID.ToString()); sbMailTemplate = sbMailTemplate.Replace("${OrderDate}", objOInfo.OrderDetail.orderCreatedOn.ToString("dd-MM-yyyy")); sbMailTemplate = sbMailTemplate.Replace("${Comments}", objOInfo.OrderDetail.remark); sbMailTemplate = sbMailTemplate.Replace("${Count}", (dt.Rows.Count - 1).ToString()); sbMailTemplate = sbMailTemplate.Replace("${TABLEDATA}", htmlTableForOrderDetail); if (this.objMU == null) { this.objMU = new MailUtility(); } objMU.SendMail(lstOfEmailIDs, Subject + " " + objOInfo.BillingAddress.companyName, true, sbMailTemplate.ToString(), null, EmailIDsInCC); } }
internal static void ShowPrintTravel(OrderDetailDto order, PassengerDto passenger, ResponseChangeOrder rasorder = null, ResponseAfterSalePassenger raspassenger = null, int flag = 0, OrderInfoViewModel orderInfoViewModel = null, AfterSaleInfoViewModel afterSaleInfoViewModel = null, Action <bool?> call = null) { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { var window = new PrintTravelWindow { Owner = Application.Current.MainWindow }; var vm = new PrintTravelViewModel { RspOrder = order, Passenger = passenger, RsAferSaleOrder = rasorder, RsAfterSalePassenger = raspassenger, RFlag = flag, OrderInfoViewModel = orderInfoViewModel, AfterSaleInfoViewModel = afterSaleInfoViewModel }; vm.Init(); window.DataContext = vm; var result = window.ShowDialog(); if (call != null) { call(result); } window.DataContext = null; })); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(41, 2, true); WriteLiteral("\r\n"); EndContext(); #line 3 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" ViewData["Title"] = "BD Market - Order Details"; ViewData["OrderActive"] = "active"; OrderInfoViewModel orderInfo = ViewBag.OrderInfo; decimal total = 0; #line default #line hidden BeginContext(224, 114, true); WriteLiteral("\r\n<div class=\"container-fluid\">\r\n <ol class=\"breadcrumb\">\r\n <li class=\"breadcrumb-item\">\r\n <a"); EndContext(); BeginWriteAttribute("href", " href=\"", 338, "\"", 385, 1); #line 13 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 345, Url.Action("ViewAllOrders", "OrderItem"), 345, 40, false); #line default #line hidden EndWriteAttribute(); BeginContext(386, 465, true); WriteLiteral(@">Order</a> </li> <li class=""breadcrumb-item active"">Order Details</li> </ol> <div class=""row"" id=""myDiv""> <div class=""col-md-3""></div> <div class=""col-md-6""> <h2>Order Details</h2> <hr /> <div class=""form-horizontal""> <div class=""form-group""> <label>First Name</label> <br /> <input type=""text"""); EndContext(); BeginWriteAttribute("value", " value=\"", 851, "\"", 879, 1); #line 29 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 859, orderInfo.FirstName, 859, 20, false); #line default #line hidden EndWriteAttribute(); BeginContext(880, 254, true); WriteLiteral(" class=\"form-control\" readonly=\"readonly\" />\r\n <br />\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Last Name</label>\r\n <br />\r\n <input type=\"text\""); EndContext(); BeginWriteAttribute("value", " value=\"", 1134, "\"", 1161, 1); #line 36 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 1142, orderInfo.LastName, 1142, 19, false); #line default #line hidden EndWriteAttribute(); BeginContext(1162, 250, true); WriteLiteral(" class=\"form-control\" readonly=\"readonly\" />\r\n <br />\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Email</label>\r\n <br />\r\n <input type=\"text\""); EndContext(); BeginWriteAttribute("value", " value=\"", 1412, "\"", 1436, 1); #line 43 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 1420, orderInfo.Email, 1420, 16, false); #line default #line hidden EndWriteAttribute(); BeginContext(1437, 250, true); WriteLiteral(" class=\"form-control\" readonly=\"readonly\" />\r\n <br />\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Phone</label>\r\n <br />\r\n <input type=\"text\""); EndContext(); BeginWriteAttribute("value", " value=\"", 1687, "\"", 1711, 1); #line 50 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 1695, orderInfo.Phone, 1695, 16, false); #line default #line hidden EndWriteAttribute(); BeginContext(1712, 256, true); WriteLiteral(@" class=""form-control"" readonly=""readonly"" /> <br /> </div> <div class=""form-group""> <label>Address One</label> <br /> <input type=""text"""); EndContext(); BeginWriteAttribute("value", " value=\"", 1968, "\"", 1997, 1); #line 57 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 1976, orderInfo.AddressOne, 1976, 21, false); #line default #line hidden EndWriteAttribute(); BeginContext(1998, 256, true); WriteLiteral(@" class=""form-control"" readonly=""readonly"" /> <br /> </div> <div class=""form-group""> <label>Address Two</label> <br /> <input type=""text"""); EndContext(); BeginWriteAttribute("value", " value=\"", 2254, "\"", 2283, 1); #line 64 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 2262, orderInfo.AddressTwo, 2262, 21, false); #line default #line hidden EndWriteAttribute(); BeginContext(2284, 253, true); WriteLiteral(" class=\"form-control\" readonly=\"readonly\" />\r\n <br />\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Order By</label>\r\n <br />\r\n <input type=\"text\""); EndContext(); BeginWriteAttribute("value", " value=\"", 2537, "\"", 2572, 1); #line 71 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 2545, orderInfo.ActionByUserName, 2545, 27, false); #line default #line hidden EndWriteAttribute(); BeginContext(2573, 259, true); WriteLiteral(@" class=""form-control"" readonly=""readonly"" /> <br /> </div> <div class=""form-group""> <label>Order By Email</label> <br /> <input type=""text"""); EndContext(); BeginWriteAttribute("value", " value=\"", 2832, "\"", 2868, 1); #line 78 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 2840, orderInfo.ActionByUserEmail, 2840, 28, false); #line default #line hidden EndWriteAttribute(); BeginContext(2869, 255, true); WriteLiteral(" class=\"form-control\" readonly=\"readonly\" />\r\n <br />\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Order Time</label>\r\n <br />\r\n <input type=\"text\""); EndContext(); BeginWriteAttribute("value", " value=\"", 3124, "\"", 3153, 1); #line 85 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 3132, orderInfo.ActionTime, 3132, 21, false); #line default #line hidden EndWriteAttribute(); BeginContext(3154, 142, true); WriteLiteral(" class=\"form-control\" readonly=\"readonly\" />\r\n <br />\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n"); EndContext(); #line 90 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" if (orderInfo.OrderItemViewModels.Count > 0) { #line default #line hidden BeginContext(3386, 31, true); WriteLiteral(" <button"); EndContext(); BeginWriteAttribute("onclick", " onclick=\"", 3417, "\"", 3520, 3); WriteAttributeValue("", 3427, "location.href=\'", 3427, 15, true); #line 92 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" WriteAttributeValue("", 3442, Url.Action("PrintBillingInfo", "OrderItem", new { infoId = orderInfo.InfoId }), 3442, 76, false); #line default #line hidden WriteAttributeValue("", 3518, "\';", 3518, 2, true); EndWriteAttribute(); BeginContext(3521, 70, true); WriteLiteral(" class=\"add_button\"><i class=\"fas fa-print\"></i> Print Bill</button>\r\n"); EndContext(); #line 93 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" } #line default #line hidden BeginContext(3614, 864, true); WriteLiteral(@" </div> </div> </div> <div class=""col-md-3""></div> </div> <div class=""card mb-3""> <div class=""card-header""> <i class=""fas fa-table""></i> Order Items </div> <div class=""card-body""> <div class=""table-responsive""> <table class=""table table-bordered"" id=""dataTable"" width=""100%"" cellspacing=""0""> <thead> <tr> <th>SL</th> <th>Item Name</th> <th>Category Name</th> <th>Quantity</th> <th>Price</th> <th>Order ID</th> </tr> </thead> <tbody> "); EndContext(); #line 120 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" int count = 1; int totalRows = orderInfo.OrderItemViewModels.Count; foreach (OrderItemViewModel order in orderInfo.OrderItemViewModels) { #line default #line hidden BeginContext(4762, 78, true); WriteLiteral(" <tr>\r\n <td>"); EndContext(); BeginContext(4841, 5, false); #line 127 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" Write(count); #line default #line hidden EndContext(); BeginContext(4846, 47, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(4894, 17, false); #line 128 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" Write(order.ProductName); #line default #line hidden EndContext(); BeginContext(4911, 47, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(4959, 18, false); #line 129 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" Write(order.CategoryName); #line default #line hidden EndContext(); BeginContext(4977, 47, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(5025, 14, false); #line 130 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" Write(order.Quantity); #line default #line hidden EndContext(); BeginContext(5039, 47, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(5087, 18, false); #line 131 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" Write(order.ProductPrice); #line default #line hidden EndContext(); BeginContext(5105, 47, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(5153, 13, false); #line 132 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" Write(order.OrderId); #line default #line hidden EndContext(); BeginContext(5166, 46, true); WriteLiteral("</td>\r\n </tr>\r\n"); EndContext(); #line 134 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" count++; total = order.ProductPrice + total; } #line default #line hidden BeginContext(5385, 284, true); WriteLiteral(@" </tbody> <tfoot> <tr> <th></th> <th></th> <th></th> <th>Total: </th> <th>"); EndContext(); BeginContext(5670, 5, false); #line 147 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" Write(total); #line default #line hidden EndContext(); BeginContext(5675, 197, true); WriteLiteral("</th>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n </div>\r\n </div>\r\n <div class=\"card-footer small text-muted\">Updated Table at "); EndContext(); BeginContext(5873, 26, false); #line 153 "Z:\Dot Net Core\BdMarketWebApp\BdMarketWebApp\Views\OrderItem\ViewOrderDetails.cshtml" Write(DateTime.Now.ToString("F")); #line default #line hidden EndContext(); BeginContext(5899, 26, true); WriteLiteral("</div>\r\n </div>\r\n</div>"); EndContext(); }
public void SendMailPreBookOrder(int OrderID, int CustomerId, string TemplatePath, string Subject, bool SentToCustomer = false) { StringBuilder sbMailTemplate = new StringBuilder(); sbMailTemplate.Append(System.IO.File.ReadAllText(TemplatePath)); OrderInfoViewModel objOInfo = OrderInfo(OrderID); List<string> lstOfEmailIDs = new List<string>(); if (SentToCustomer && objOInfo != null && objOInfo.UserDetail != null) { lstOfEmailIDs.Add(objOInfo.UserDetail.emailId); } else { lstOfEmailIDs.Add(ConfigurationManager.AppSettings["Email_ID"].ToString()); lstOfEmailIDs.Add(ConfigurationManager.AppSettings["CCemail"].ToString()); } if (objOInfo != null && objOInfo.BillingAddress != null) { List<string> objLst = objOInfo.OrderItemDetail.Select(x => x.Stock).ToList(); string LotNos = "LOTNO~" + string.Join(",", objLst); DataTable dt = this.objStockDetailsService.GetDataForExcelExport(LotNos, false, CustomerId); if (dt.Columns.Count > 0) { dt.Columns.Remove("Sizes"); dt.Columns.Remove("CertificateNo"); dt.Columns.Remove("Reportdate"); dt.Columns.Remove("EyeClean"); dt.Columns.Remove("Shade"); dt.Columns.Remove("TableBlack"); dt.Columns.Remove("SideBlack"); dt.Columns.Remove("Milky"); dt.Columns.Remove("CuletSize"); dt.Columns.Remove("OpensName"); dt.Columns.Remove("GroupName"); dt.Columns.Remove("MemberComments"); dt.Columns.Remove("refdata"); dt.Columns.Remove("V360"); dt.Columns.Remove("Video"); if (SentToCustomer == true) { dt.Columns.Remove("SalesLocation"); } } DataTable dtOrderCharges = objOInfo.ConvertOrderChangesInDatetable(); string htmlTableForOrderDetail = CommonFunction.ConvertDataTableToHTML(dt, false, true); string htmlTableForOrderChargesDetail = CommonFunction.ConvertDataTableToHTML(dtOrderCharges, false, true); sbMailTemplate = sbMailTemplate.Replace("${CustomerName}", objOInfo.BillingAddress.firstName + " " + objOInfo.BillingAddress.lastName); sbMailTemplate = sbMailTemplate.Replace("${OrderNo}", OrderID.ToString()); sbMailTemplate = sbMailTemplate.Replace("${TABLEDATA}", htmlTableForOrderDetail); sbMailTemplate = sbMailTemplate.Replace("${TABLEDATAFORCHARGES}", htmlTableForOrderChargesDetail); sbMailTemplate = sbMailTemplate.Replace("${CompanyName}", objOInfo.BillingAddress.companyName); sbMailTemplate = sbMailTemplate.Replace("${Address}", objOInfo.BillingAddress.address01 + " " + objOInfo.BillingAddress.address02); sbMailTemplate = sbMailTemplate.Replace("${CountryName}", objOInfo.BillingAddress.countryName); sbMailTemplate = sbMailTemplate.Replace("${phoneCode01}", objOInfo.UserDetail.phoneCode01); sbMailTemplate = sbMailTemplate.Replace("${phone01}", objOInfo.UserDetail.phone01); sbMailTemplate = sbMailTemplate.Replace("${emailId}", objOInfo.UserDetail.emailId); sbMailTemplate = sbMailTemplate.Replace("${bankName}", objOInfo.UserDetail.bankName); sbMailTemplate = sbMailTemplate.Replace("${branchName}", objOInfo.UserDetail.branchName); sbMailTemplate = sbMailTemplate.Replace("${branchAddress}", objOInfo.UserDetail.branchAddress); sbMailTemplate = sbMailTemplate.Replace("${accNumber}", objOInfo.UserDetail.accNumber); sbMailTemplate = sbMailTemplate.Replace("${swiftCode}", objOInfo.UserDetail.swiftCode); if (this.objMU == null) { this.objMU = new MailUtility(); } objMU.SendMail(lstOfEmailIDs, Subject, true, sbMailTemplate.ToString()); } }