Exemple #1
0
 public AddPaymentWindow(OrderWindow ow, MegaStockistModel msm, OrderHistoryModel ohm)
 {
     orderWin       = ow;
     megaStockModel = msm;
     orderHistory   = ohm;
     InitializeComponent();
 }
Exemple #2
0
 public AddPaymentWindow(OrderWindow ow, EmployeeModel em, OrderHistoryModel ohm)
 {
     orderWin       = ow;
     employeesModel = em;
     orderHistory   = ohm;
     InitializeComponent();
 }
Exemple #3
0
 public AddPaymentWindow(OrderWindow ow, DepotStockistModel dsm, OrderHistoryModel ohm)
 {
     orderWin        = ow;
     depotStockModel = dsm;
     orderHistory    = ohm;
     InitializeComponent();
 }
Exemple #4
0
 public AddPaymentWindow(OrderWindow ow, MembersModel mm, OrderHistoryModel ohm)
 {
     orderWin     = ow;
     membersModel = mm;
     orderHistory = ohm;
     InitializeComponent();
 }
Exemple #5
0
        public IHttpActionResult GetOrderHistoryByOrderId(OrderHistoryModel model)
        {
            using (var context = new TasteContext())
            {
                var order = context.Orders.FirstOrDefault(o => o.OrderId == model.OrderId);
                if (order == null)
                {
                    return(Ok(GetErrorModel(ApiErrorCode.OrderDoesNotExist)));
                }

                var details = context.OrderedDishes.Where(od => od.OrderId == order.OrderId);
                var models  = new List <OrderedDishModel>();
                foreach (var d in details)
                {
                    models.Add(ToModel(d));
                }
                return(Ok(new OrderHistoryModel
                {
                    DateTime = order.Datetime,
                    OrderId = order.OrderId,
                    Table = order.TableName,
                    Details = models,
                    TipInPennies = order.Paid ? order.TipInPennies : 0,
                    TotalInPennies = order.TotalInPennies,
                    TaxInPennies = order.TaxInPennies
                }));
            }
        }
Exemple #6
0
        public ViewResult GetHistoryLog(string TimeFrom, string TimeTo)
        {
            if (TimeFrom == null || TimeTo == null)
            {
                ModelState.AddModelError("TimeFrom", Resources.Orders.OrdersResource.DateRequiredError);
            }

            if (ModelState.IsValid)
            {
                var orders = _orderService.GetOrdersLog(DateTime.Parse(TimeFrom), DateTime.Parse(TimeTo));

                var orderView = Mapper.Map <IEnumerable <Order>, List <OrderViewModel> >(orders);

                var orderHistoryModel = new OrderHistoryModel
                {
                    OrderModels = orderView,
                    TimeFrom    = TimeFrom,
                    TimeTo      = TimeTo
                };

                return(View("History", orderHistoryModel));
            }

            var orderModel = new OrderHistoryModel();

            orderModel.TimeFrom = TimeFrom;
            orderModel.TimeTo   = TimeTo;

            return(View("History", orderModel));
        }
Exemple #7
0
/// <summary>
/// 更新信息
/// </summary>
        public int UpdateInfo(SqlTransaction trans, OrderHistoryModel ordModel, long SN)
        {
            string key = "Cache_OrderHistory_Model_" + SN;

            CacheHelper.RemoveCache(key);
            return(ordDAL.UpdateInfo(trans, ordModel, SN));
        }
Exemple #8
0
        private OrderHistoryModel GetOrderHistoryList(uint?buyerID, uint?merchantOwnerID)
        {
            string where = "";
            if (buyerID != null)
            {
                where = string.Format("buyer_id={0}", buyerID);
            }
            else
            {
                where = string.Format("merchant_owner_id={0}", merchantOwnerID);
            }

            List <ViewOrderHistoryListModel> list = db.SelectData <ViewOrderHistoryListModel>("view_orderhistory", where);

            if (list == null)
            {
                throw new UnfulfilException("/language/database/no_record");
            }

            OrderHistoryModel historyList = new OrderHistoryModel();

            foreach (ViewOrderHistoryListModel orderHistory in list)
            {
                historyList.Add(orderHistory);
            }

            return(historyList);
        }
Exemple #9
0
 public AddPaymentWindow(OrderWindow ow, HomeStockistModel hsm, OrderHistoryModel ohm)
 {
     orderWin       = ow;
     homeStockModel = hsm;
     orderHistory   = ohm;
     InitializeComponent();
 }
Exemple #10
0
        private void btnDRDetails_Click(object sender, RoutedEventArgs e)
        {
            ohm = dgvdr.SelectedItem as OrderHistoryModel;

            if (ohm != null)
            {
                lblDrNumber.Content   = "DR NUMBER: " + ohm.DRNumber;
                lblDate.Content       = "DATE: " + ohm.DRDate;
                lblClientName.Content = "CLIENT NAME: " + viewMegaStockist.Fullname;

                dgvPackages.ItemsSource       = getPackagesOnDR(ohm.ID);
                dgvProducts.ItemsSource       = getProductsOnDR(ohm.ID);
                dgvPaymentHistory.ItemsSource = getPaymentHistory();
                if (ohm.ifPaid.Equals("YES"))
                {
                    lblBalance.Content = "0.0";
                }
                else
                {
                    lblBalance.Content = (dblTotalView - getBalanceOnDR()).ToString("N0");
                }

                flyout.IsOpen = true;
            }
        }
        public ActionResult Index()
        {
            OrderHistoryModel model = new OrderHistoryModel();

            model.tables = unitOfWork.Tables.GetAll().ToList();
            model.orders = unitOfWork.Orders.GetAll().ToList();
            return(View(model));
        }
Exemple #12
0
        private void btnEditDR_Click(object sender, RoutedEventArgs e)
        {
            OrderHistoryModel orderHistMod = dgvdr.SelectedItem as OrderHistoryModel;

            if (orderHistMod != null)
            {
                OrderWindow orderWin = new OrderWindow(viewMegaStockist, orderHistMod);
                orderWin.ShowDialog();
            }
        }
Exemple #13
0
        public async Task <int> Save(OrderHistoryModel model)
        {
            var order = new Order.DAL.OrderHistory
            {
                OrderId       = model.OrderId,
                OrderStatusId = model.OrderStatusId
            };

            _context.OrderHistory.Add(order);
            return(await this.UnitOfWork.SaveChangesAsync());
        }
Exemple #14
0
        public async Task <IActionResult> AdminView(int pageNumber = 0)
        {
            var model = new OrderHistoryModel();

            //var orders = await _orderService.QueryAllAdminOrdersAsync();
            var orders = _orderService.GetAllAdminOrdersByPage(pageNumber, orderConfirmationOrdersPerPage);

            List <OrderReviewModel> reviews = new List <OrderReviewModel>();

            foreach (Order o in orders)
            {
                OrderReviewModel orm = await _orderService.FindOrderReviewAsync(o.Id);

                if (orm != null)
                {
                    orm.CustomerComment = orm.Rating + ": " + orm.CustomerComment;
                    reviews.Add(orm);
                }
            }

            model.Orders  = orders;
            model.Reviews = reviews;

            if (TempData["AdminConfirmOrderConcurrency"] != null)
            {
                ModelState.AddModelError(string.Empty, TempData["AdminConfirmOrderConcurrency"].ToString());
            }

            // pagination
            int pageCount = _orderService.GetAdminOrdersPageCount(orderConfirmationOrdersPerPage);

            ViewBag.PageCount = pageCount;

            if (pageNumber + 1 < pageCount)
            {
                ViewBag.NextPageNumber = pageNumber + 1;
            }
            else
            {
                ViewBag.NextPageNumber = null;
            }
            if (pageNumber > 0)
            {
                ViewBag.PreviousPageNumber = pageNumber - 1;
            }
            else
            {
                ViewBag.PreviousPageNumber = null;
            }

            ViewBag.CurrentPageNumber = pageNumber;

            return(View(model));
        }
        public async Task <IActionResult> Post([FromBody] OrderHistoryModel model)
        {
            if (model is null)
            {
                return(BadRequest());
            }

            var result = await _services.Save(model);

            return(result > 0 ? (IActionResult)Ok(result) : (IActionResult)BadRequest());
        }
Exemple #16
0
        public async Task <IActionResult> Index(int pageNumber = 0)
        {
            var model = new OrderHistoryModel();

            var user = await _userManager.GetUserAsync(HttpContext.User);

            //var orders = await _orderService.QueryAllOrdersAsync(user);
            var orders = _orderService.GetAllOrdersByPage(user, pageNumber, orderHistoryOrdersPerPage);

            List <OrderReviewModel> reviews = new List <OrderReviewModel>();

            foreach (Order o in orders)
            {
                OrderReviewModel orm = await _orderService.FindOrderReviewAsync(o.Id);

                if (orm != null)
                {
                    orm.CustomerComment = orm.Rating + ": " + orm.CustomerComment;
                    reviews.Add(orm);
                }
            }

            model.Orders  = orders;
            model.Reviews = reviews;

            // pagination
            int pageCount = _orderService.GetOrdersPageCount(user, orderHistoryOrdersPerPage);

            ViewBag.PageCount = pageCount;

            if (pageNumber + 1 < pageCount)
            {
                ViewBag.NextPageNumber = pageNumber + 1;
            }
            else
            {
                ViewBag.NextPageNumber = null;
            }
            if (pageNumber > 0)
            {
                ViewBag.PreviousPageNumber = pageNumber - 1;
            }
            else
            {
                ViewBag.PreviousPageNumber = null;
            }

            ViewBag.CurrentPageNumber = pageNumber;

            return(View(model));
        }
        public ActionResult OrderHistory(string userId)
        {
            OrderHistoryModel model = new OrderHistoryModel();
            var currentUser         = context.Users.Where(b => b.UserName == User.Identity.Name).First();
            List <List <ShoppingCartModel> > listOfModel = new List <List <ShoppingCartModel> >();
            var orders = context.Orders.Include("Items").Where(a => a.User.Id == currentUser.Id && a.completed == true && a.Deliverer.Id == userId);

            foreach (var item in orders)
            {
                listOfModel.Add(item.Items);
            }
            model.ItemList = listOfModel;
            return(View(model));
        }
        public ActionResult MyOrders()
        {
            if (!User.Identity.IsAuthenticated)
            {
                // User not authenticated
                // Response 401 Unauthenticated
                Response.StatusCode = 401;
                Response.End();
            }
            var currUserName = User.Identity.Name;
            var userId = appdb.Users.Where(u => u.UserName == currUserName).FirstOrDefault().Id;
            var orders = db.Order.Where(o => o.UserId == userId).OrderBy(o => o.DateTimeCreated).ToList();

            OrderHistoryModel model = new OrderHistoryModel();
            model.Orders = new List<OrderDetails>();

            foreach (var o in orders)
            {
                var tourDateTime = db.TourDateTime.Where(t => t.Id == o.TourDateTimeId).FirstOrDefault();
                var tourDateId = tourDateTime.TourDateId;
                var tourTimeId = tourDateTime.TourTimeId;
                var tourDate = db.TourDate.Where(t => t.Id == tourDateId).FirstOrDefault();
                var tourTime = db.TourTime.Where(t => t.Id == tourTimeId).FirstOrDefault();
                var tourLocationId = db.TourTimeTable.Where(t => t.TourTimeId == tourTime.Id && t.StartTime == tourTime.StartTime).FirstOrDefault().LocationId;
                var tourLocationName = db.Location.Where(l => l.Id == tourLocationId).FirstOrDefault().Name;
                var tour = db.Tour.Where(t => t.Id == tourTime.TourId).FirstOrDefault();

                OrderDetails order = new OrderDetails() 
                {
                    AdultQuantity = o.AdultQuantity,
                    ChildQuantity = o.ChildQuantity,
                    TotalPrice = o.TotalPrice,
                    DateTimeCreated = o.DateTimeCreated,
                    UserId = o.UserId,
                    TourDateTimeId = o.TourDateTimeId,
                    StartingLocation = tourLocationName,
                    StringTourTime = tourTime.StartTime + "-" + tourTime.EndTime,
                    DateTimeTourDate = tourDate.DateOfTour,
                    TourName = tour.Name,
                    TourId = tour.Id,
                    TotalChildPrice = o.ChildQuantity * tour.ChildPrice,
                    TotalAdultPrice = o.AdultQuantity * tour.AdultPrice,
                };
                model.Orders.Add(order);
            }

            return PartialView(model);
        }
Exemple #19
0
/// <summary>
/// 从缓存读取信息
/// </summary>
        public OrderHistoryModel GetCacheInfo(SqlTransaction trans, long SN)
        {
            string key   = "Cache_OrderHistory_Model_" + SN;
            object value = CacheHelper.GetCache(key);

            if (value != null)
            {
                return((OrderHistoryModel)value);
            }
            else
            {
                OrderHistoryModel ordModel = ordDAL.GetInfo(trans, SN);
                CacheHelper.AddCache(key, ordModel, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(20), CacheItemPriority.Normal, null);
                return(ordModel);
            }
        }
        public static List <OrderHistoryModel> GerOrderHistory(int deptid, out string error)
        {
            LUSSISEntities entities = new LUSSISEntities();

            // Initializing the error variable to return only blank if there is no error
            error = "";
            // List<RequisitionDetailsModel> ordh = new List<RequisitionDetailsModel>();
            List <OrderHistoryModel> orhm = new List <OrderHistoryModel>();

            try
            {
                //List<requisitiondetail> reqdetail = entities.requisitiondetails.Where(p => p.requisition.deptid == deptid).ToList();
                List <requisitiondetail> reqdetail = entities.requisitiondetails.Where(p => p.requisition.status == ConRequisition.Status.COMPLETED && p.requisition.deptid == deptid).Distinct().ToList();


                foreach (var order in reqdetail)
                {
                    OrderHistoryModel o = new OrderHistoryModel();



                    o.Reqdate   = order.requisition.reqdate;
                    o.Deptid    = order.requisition.deptid;
                    o.Cpname    = order.requisition.collectionpoint.cpname;
                    o.Raisename = order.requisition.user.username;
                    o.Deptname  = order.requisition.department.deptname;


                    if (order.requisition.status == ConRequisition.Status.COMPLETED)
                    {
                        o.Status = "Completed Order";
                    }

                    orhm.Add(o);
                }
            }
            catch (NullReferenceException)
            {
                error = ConError.Status.NOTFOUND;
            }
            catch (Exception e)
            {
                error = e.Message;
            }

            return(orhm);
        }
Exemple #21
0
        public ViewResult History()
        {
            var defaultTimeFrom = DateTime.UtcNow.AddDays(-60);
            var defaultTimeTo   = DateTime.UtcNow.AddDays(-30);

            var orders = _orderService.GetOrdersLog(defaultTimeFrom, defaultTimeTo);

            var orderView = Mapper.Map <IEnumerable <Order>, List <OrderViewModel> >(orders);

            var orderHistoryModel = new OrderHistoryModel
            {
                OrderModels = orderView,
                TimeFrom    = defaultTimeFrom.ToLocalTime().ToShortDateString(),
                TimeTo      = defaultTimeTo.ToLocalTime().ToShortDateString()
            };

            return(View(orderHistoryModel));
        }
Exemple #22
0
        private async void btnDeleteDR_Click(object sender, RoutedEventArgs e)
        {
            OrderHistoryModel orderHist = dgvdr.SelectedItem as OrderHistoryModel;

            MahApps.Metro.Controls.MetroWindow window = Window.GetWindow(this) as MahApps.Metro.Controls.MetroWindow;

            if (orderHist != null)
            {
                MessageDialogResult result = await window.ShowMessageAsync("Delete D.R.", "Are you sure you want to Delete D.R. No: " + orderHist.DRNumber, MessageDialogStyle.AffirmativeAndNegative);

                if (result == MessageDialogResult.Affirmative)
                {
                    deleteDR(orderHist.ID);
                    dgvdr.ItemsSource = loadOrdersHistory(viewMegaStockist.ID);
                    dgvdr.Items.Refresh();
                }
            }
        }
Exemple #23
0
        public async Task <ActionResult <List <OrderHistoryModel> > > GetWXUserOrder(string id)
        {
            var wXUserOrder = await _context.WXUserOrder.Where(b => b.WXUserID == id).OrderByDescending(b => b.CreateTime).ToListAsync();

            if (wXUserOrder == null)
            {
                return(NotFound());
            }
            List <OrderHistoryModel> orderHistories = new List <OrderHistoryModel>();

            System.Diagnostics.Debug.WriteLine("正在查询订单:");
            foreach (var item in wXUserOrder)
            {
                var OrderDetails = await _context.WXUserOrderDetail.Where(b => b.WXUserOrderID == item.WXPayNumber).ToListAsync();

                List <OrderHistoryDetail> orderHistoryDetails = new List <OrderHistoryDetail>();
                foreach (var item_2 in OrderDetails)
                {
                    var single_product        = _context.CommodityManage.Single(b => b.ProductID == item_2.WXProductID);
                    OrderHistoryDetail detail = new OrderHistoryDetail {
                        ProductName   = single_product.ProductName,
                        ImgLink       = single_product.ProductImage,
                        Price         = single_product.ProductPrice,
                        ProductNumber = item_2.WXProductNumber
                    };
                    orderHistoryDetails.Add(detail);
                }
                OrderHistoryModel orderHistory = new OrderHistoryModel
                {
                    DeviceName  = "西南大学零售柜",
                    OrderDate   = item.CreateTime.ToString("F"),
                    OrderDetail = JsonConvert.SerializeObject(orderHistoryDetails),
                    TotalPrice  = (float)item.TotalPrice
                };
                System.Diagnostics.Debug.WriteLine("正在查询订单详情:");
                orderHistories.Add(orderHistory);
            }
            //wXUserOrder.WXPayNumber
            //List<WXUserOrderDetail> OrderDetails = new List<WXUserOrderDetail>();
            //var OrderDetails = await _context.WXUserOrderDetail.Where(b => b.WXUserOrderID == wXUserOrder.WXPayNumber).ToListAsync();
            //orderHistory.Add();
            return(orderHistories);
        }
        private List <OrderHistoryModel> loadOrdersHistory(string strClientID)
        {
            conDB = new ConnectionDB();

            OrderHistoryModel        order           = new OrderHistoryModel();
            List <OrderHistoryModel> lstOrderHistory = new List <OrderHistoryModel>();

            queryString = "SELECT tblorderhistory.ID, clientID, drNo, total, date, IF(isPaid, 'YES', 'NO') as 'ifPaid', IF(isCancelled, 'YES', 'NO') as 'ifCancelled'" +
                          "FROM dbpackage.tblorderhistory " +
                          " WHERE tblorderhistory.isDeleted = 0 AND clientID = ? order by drNo";

            parameters = new List <string>();

            parameters.Add(strClientID);

            MySqlDataReader reader = conDB.getSelectConnection(queryString, parameters);

            while (reader.Read())
            {
                order.ID = reader["ID"].ToString();

                order.DRDate = Convert.ToDateTime(reader["date"].ToString()).ToShortDateString();

                order.ClientID = reader["clientID"].ToString();
                order.DRNumber = reader["drNo"].ToString();
                int x = Convert.ToInt32(reader["total"].ToString());
                order.Total       = x.ToString("N0");
                order.ifPaid      = reader["ifPaid"].ToString();
                order.ifCancelled = reader["ifCancelled"].ToString();
                lstOrderHistory.Add(order);
                order = new OrderHistoryModel();
            }

            conDB.closeConnection();

            return(lstOrderHistory);
        }
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            bool x = await checkField();

            orderHistory = new OrderHistoryModel();
            int iID = 0;

            if (x)
            {
                if (chkCancelled.IsChecked == true)
                {
                    iID = saveTransaction();
                    btnPayment.IsEnabled = false;
                }
                else
                {
                    iID = saveTransaction();
                    if (lstPackages.Count != 0 && lstProducts.Count != 0)
                    {
                        saveProductsAndPackages(iID.ToString());
                    }
                    btnPayment.IsEnabled = true;
                }

                if (chkIfPaid.IsChecked == true)
                {
                    addPayment(iID.ToString());
                }

                await this.ShowMessageAsync("ADD RECORD", "Record successfully saved!");

                txtDR.IsEnabled   = false;
                dateDR.IsEnabled  = false;
                btnSave.IsEnabled = false;
            }
        }
 public OrderWindow(DepotStockistModel dsm, OrderHistoryModel ohm)
 {
     orderHistory     = ohm;
     depotStockistMod = dsm;
     InitializeComponent();
 }
 public OrderWindow(HomeStockistModel hsm, OrderHistoryModel ohm)
 {
     orderHistory    = ohm;
     homeStockistMod = hsm;
     InitializeComponent();
 }
 public OrderWindow(MegaStockistModel msm, OrderHistoryModel ohm)
 {
     orderHistory    = ohm;
     megaStockistMod = msm;
     InitializeComponent();
 }
 public OrderWindow(EmployeeModel dsm, OrderHistoryModel ohm)
 {
     orderHistory        = ohm;
     employeeStockistMod = dsm;
     InitializeComponent();
 }
 public OrderWindow(MembersModel memM, OrderHistoryModel ohm)
 {
     orderHistory = ohm;
     membersMod   = memM;
     InitializeComponent();
 }