Esempio n. 1
0
        public void OrderConverterTest()
        {
            //////////INPUT DATA/////////////
            Order basicOrder = new Order()
            {
                OrderId    = 1,
                Rating     = 5,
                TermekList = new ObservableCollection <OrderListItem>(),
                Total      = 2500
            };
            ///////////////////////////////////

            //////////////////Expected Result///////////////
            ORDER exResult = new ORDER()
            {
                ORDERID    = 1,
                RATING     = 5,
                TOTALPRICE = 2500
            };
            ///////////////////////////////////////////

            //////////////Asserts///////////////////////
            var result = dataConverter.OrderConverter(basicOrder);

            Assert.That(result.ORDERID, Is.EqualTo(exResult.ORDERID));
            Assert.That(result.RATING, Is.EqualTo(exResult.RATING));
            Assert.That(result.TOTALPRICE, Is.EqualTo(exResult.TOTALPRICE));
        }
Esempio n. 2
0
        // bài viết


        public ActionResult OrderInfo(int id)
        {
            if (Session["login"] is null)
            {
                return(RedirectToAction("Login"));
            }

            int idRole = ((USER)Session["login"]).IdRole;

            if (idRole != 1)
            {
                return(RedirectToAction("Index"));
            }

            ORDER order = new ORDER();

            using (THUONGMAIDIENTUEntities db = new THUONGMAIDIENTUEntities())
            {
                order = db.ORDERs.Where(x => x.IdOrder == id).FirstOrDefault();
                if (order is null)
                {
                    return(HttpNotFound());
                }
            }
            return(View(order));
        }
        private async void ExecuteAddOrderAsync(object obj)
        {
            ORDER.CAKE_IN_ORDERS.ToList().ForEach(x => {
                UpdateCakeAmount(x.CAKE_ID, (int)x.NUMBER);
                HomeScreenViewModel.Instance.updateCakeAmount(x.CAKE_ID, x.CAKE.CAKE_TYPE, (int)x.NUMBER);
                x.CAKE = null;
            }); //TODO !!!!

            using (var db = new CAKESTOREEntities())
            {
                db.ORDERS.Add(ORDER);
                db.SaveChanges();
            };
            var SuccessMessage = new SampleMessageDialogViewModel {
                Message = "Hóa đơn hoàn tất"
            };
            var view = new SampleMessageDialog {
                DataContext = SuccessMessage
            };
            var result = await DialogHost.Show(view, MainWindowViewModel.Instance.Identifier, ExtendedOpenedEventHandler, SuccessMessageDialogClosingHandler);

            ORDER             = new ORDER();
            ORDER.TOTAL_PRICE = 0;
            ORDER.DATE_CREATE = DateTime.Now;
        }
Esempio n. 4
0
        /// <summary>
        /// 商家同意退款
        /// </summary>
        /// <returns></returns>
        public ActionResult QueryRefund(int oid)
        {
            ORDER order = RemotingHelp.GetModelObject <ORDER>();

            return(Json(
                       order.QueryRefund(oid),
                       JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        /// <summary>
        /// 获取月统计数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMonthStatistics()
        {
            ORDER order = RemotingHelp.GetModelObject <ORDER>();

            return(Json(
                       order.GetMonthStatistics(),
                       JsonRequestBehavior.AllowGet));
        }
Esempio n. 6
0
        /// <summary>
        /// 修改堂食订单为已使用
        /// </summary>
        /// <returns></returns>
        public ActionResult UseShopOder(int oid)
        {
            ORDER order = RemotingHelp.GetModelObject <ORDER>();

            return(Json(
                       order.UseShopOder(oid),
                       JsonRequestBehavior.AllowGet));
        }
        public ActionResult DeleteConfirmed(string id)
        {
            ORDER oRDER = db.ORDERS.Find(id);

            db.ORDERS.Remove(oRDER);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed(string customerID, string orderID)
        {
            ORDER oRDER = db.ORDER.Find(orderID);

            db.ORDER.Remove(oRDER);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ORDER order = db.ORDERS.Single(o => o.ID == id);

            db.ORDERS.DeleteObject(order);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 10
0
        public ORDER GetByID(int Order_ID)
        {
            DataClasses1DataContext context = new DataClasses1DataContext();
            ORDER order = context.ORDERs
                          .FirstOrDefault(x => x.ORD_ID == Order_ID);

            return(order);
        }
Esempio n. 11
0
        //
        // GET: /Orders/Edit/5

        public ActionResult Edit(int id)
        {
            ORDER order = db.ORDERS.Single(o => o.ID == id);

            ViewBag.CUSTOMER_ID = new SelectList(db.CUSTOMERS, "ID", "NAME", order.CUSTOMER_ID);
            ViewBag.EMPLOYEE_ID = new SelectList(db.EMPLOYEES, "ID", "LOGIN", order.EMPLOYEE_ID);
            return(View(order));
        }
Esempio n. 12
0
        public string PayNotify()
        {
            String xmlData = getPostStr();
            //保存付款成功过来的数据
            ORDER order = RemotingHelp.GetModelObject <ORDER>();

            return(order.PayNotify(xmlData));
        }
Esempio n. 13
0
        public ActionResult DeleteConfirmed(int id)
        {
            ORDER Order = db.ORDERS.Find(id);

            db.ORDERS.Remove(Order);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 14
0
        public ActionResult DeleteConfirm(int id)
        {
            ORDER order = model.ORDERs.Find(id);

            model.ORDERs.Remove(order);
            model.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 15
0
 public bool UpdateOrder(ORDER order)
 {
     using (var _db = new SiriusIQEntities2())
     {
         _db.Entry(order);
         int state = _db.SaveChanges();
         return(state == 0 ? false : true);
     }
 }
Esempio n. 16
0
 public bool AddOrder(ORDER orderBusiness)
 {
     using (var _db = new SiriusIQEntities2())
     {
         _db.ORDERs.Add(orderBusiness);
         int state = _db.SaveChanges();
         return(state == 0 ? false : true);
     }
 }
Esempio n. 17
0
 public OrderDataModel(ORDER order)
 {
     Id            = order.ID;
     ProductId     = order.PRODUCTID;
     StoreId       = order.STOREID;
     OrderStatusId = order.ORDERSTATUSID;
     Quantity      = order.QUANTITY;
     IsRealized    = order.ISREALIZED;
 }
Esempio n. 18
0
 public ActionResult Edit(ORDER order)
 {
     if (ModelState.IsValid)
     {
         model.Entry(order).State = System.Data.Entity.EntityState.Modified;
         model.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
Esempio n. 19
0
 protected override bool EqualsRDATA(RR rr)
 {
     return(ORDER.Equals(((NAPTR)rr).ORDER) &&
            PREFERENCE.Equals(((NAPTR)rr).PREFERENCE) &&
            FLAGS.Equals(((NAPTR)rr).FLAGS) &&
            SERVICES.Equals(((NAPTR)rr).SERVICES) &&
            REGEXP.Equals(((NAPTR)rr).REGEXP) &&
            REPLACEMENT.Equals(((NAPTR)rr).REPLACEMENT));
 }
Esempio n. 20
0
        /// <summary>
        /// Chuyển đối tượng Dữ liệu sang đối tượng DTO
        /// </summary>
        /// <param name="pOrder"></param>
        /// <returns></returns>
        public static OrderDTO ToOrderDTO(ORDER pOrder)
        {
            OrderDTO orderDTO = new OrderDTO();

            orderDTO.Id           = pOrder.Id;
            orderDTO.UserId       = (int)pOrder.UserId;
            orderDTO.PurchaseDate = (DateTime)pOrder.PurchaseDate;
            return(orderDTO);
        }
Esempio n. 21
0
        public ActionResult ChangeStateThree(int id)
        {
            ORDER order = db.ORDERS.Single(o => o.ID == id);

            order.STATE             = 4;
            order.SENDING_LIST_DATE = DateTime.Now;
            db.SaveChanges();
            return(RedirectToAction("ReadyToSend"));
        }
Esempio n. 22
0
        public ActionResult ChangeStateTwo(int id)
        {
            ORDER order = db.ORDERS.Single(o => o.ID == id);

            order.STATE            = 3;
            order.CHECK_DEPOT_DATE = DateTime.Now;
            db.SaveChanges();
            return(RedirectToAction("InAttention"));
        }
Esempio n. 23
0
        public ActionResult Edit(int id, ORDER o)
        {
            var order = model.ORDERs.FirstOrDefault(x => x.ID == id);

            order.STATUSBILL_ID = o.STATUSBILL_ID;
            order.ACCOUNT_ID    = o.ACCOUNT_ID;
            model.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 24
0
        /// <summary>
        /// Chuyển đối tượng DTO sang đối tượng dữ liệu
        /// </summary>
        /// <param name="pOrderDTO"></param>
        /// <returns></returns>
        public static ORDER ToOrder(OrderDTO pOrderDTO)
        {
            ORDER order = new ORDER();

            order.Id           = pOrderDTO.Id;
            order.UserId       = pOrderDTO.UserId;
            order.PurchaseDate = pOrderDTO.PurchaseDate;
            return(order);
        }
Esempio n. 25
0
        /// <summary>
        /// 订单列表页
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="orderState"></param>
        /// <returns></returns>
        //public ActionResult ListOrder(DateTime startTime, DateTime endTime,int page,int count)
        //{
        //    var sTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
        //    var eTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
        //    ORDER order = RemotingHelp.GetModelObject<ORDER>();
        //    var sqlWhere = $@" AND bsp_orders.addtime between '{sTime}' AND '{eTime}'";
        //    var list = order.GetOrderList(sqlWhere, page, count);
        //    ViewBag.OrderList = list;
        //    ViewBag.page = page;
        //    return PartialView();
        //}

        /// <summary>
        /// 销售统计
        /// </summary>
        /// <returns></returns>
        public ActionResult Statistics()
        {
            ORDER order = RemotingHelp.GetModelObject <ORDER>();

            ViewBag.TodayStat = order.GetDayStatistics();
            ViewBag.WeekStat  = order.GetWeekStatistics();
            ViewBag.MonthStat = order.GetMonthStatistics();
            return(View());
        }
Esempio n. 26
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            SendOrderReportData ds = new SendOrderReportData();
            DataTable           SendOrderHeader = ds.Tables["SendOrderHeader"];
            DataTable           SendOrderDetail = ds.Tables["SendOrderDetail"];
            DataTable           SendOrderFooter = ds.Tables["SendOrderFooter"];

            var   cmd      = new OrderService();
            ORDER item     = cmd.Select(Convert.ToInt32(ViewState["orderId"]));
            var   cmdStore = new StoreService();

            item.STORE = cmdStore.Select(item.STORE_ID);
            var cmdOrderdetail = new OrderDetailService();

            item.ORDER_DETAIL = cmdOrderdetail.GetALLInclude(item.ORDER_ID);
            DataRow drSendOrderHeader = SendOrderHeader.NewRow();

            drSendOrderHeader["STORE_NAME"] = item.STORE.STORE_NAME;
            drSendOrderHeader["STORE_ADDR"] = item.STORE.STORE_ADDR1;
            drSendOrderHeader["STORE_TEL"]  = item.STORE.STORE_TEL1;
            if (item.STORE.STORE_TEL2 != "")
            {
                drSendOrderHeader["STORE_TEL"] += ("," + item.STORE.STORE_TEL2);
            }
            drSendOrderHeader["STORE_CODE"]  = item.STORE.STORE_CODE;
            drSendOrderHeader["ORDER_DATE"]  = item.ORDER_DATE.Value.ToShortDateString();
            drSendOrderHeader["SEND_DATE"]   = DateTime.Now.ToShortDateString();
            drSendOrderHeader["ZONE_NAME"]   = item.STORE.ZONE.ZONE_NAME;
            drSendOrderHeader["VEHICLE_REG"] = ddlVehicle.SelectedItem.Text;
            SendOrderHeader.Rows.Add(drSendOrderHeader);
            int     seq       = 1;
            decimal sumWeight = 0;

            foreach (ORDER_DETAIL od in item.ORDER_DETAIL)
            {
                DataRow drSendOrderDetail = SendOrderDetail.NewRow();
                drSendOrderDetail["SEQ"]        = seq.ToString();
                drSendOrderDetail["NAME"]       = od.PRODUCT.PRODUCT_NAME;
                drSendOrderDetail["QTY"]        = (od.PRODUCT_QTY - od.PRODUCT_SEND_QTY).ToString();
                drSendOrderDetail["PACKAGE"]    = od.PRODUCT.PRODUCT_PACKING_DESC;
                drSendOrderDetail["WEIGHT"]     = od.PRODUCT.PRODUCT_WEIGHT;
                drSendOrderDetail["SUM_WEIGHT"] = (od.PRODUCT.PRODUCT_WEIGHT * (od.PRODUCT_QTY - od.PRODUCT_SEND_QTY)).ToString();
                sumWeight += (od.PRODUCT.PRODUCT_WEIGHT * (od.PRODUCT_QTY - od.PRODUCT_SEND_QTY)).Value;
                SendOrderDetail.Rows.Add(drSendOrderDetail);
                seq++;
            }

            DataRow drSendOrderFooter = SendOrderFooter.NewRow();

            drSendOrderFooter["SUM_WEIGHT_TH"]     = ThaiBaht(sumWeight.ToString());
            drSendOrderFooter["SUM_WEIGHT_NUMBER"] = sumWeight.ToString();
            SendOrderFooter.Rows.Add(drSendOrderFooter);

            Session["SendOrderReportData"] = ds;
            Response.Redirect("../Reports/SendOrder.aspx");
        }
Esempio n. 27
0
        //
        // GET: /Orders/Edit/5

        public ActionResult ChangeStateOne(int id)
        {
            ORDER order = db.ORDERS.Single(o => o.ID == id);

            order.STATE          = 2;
            order.ATTENTION_DATE = DateTime.Now;

            db.SaveChanges();
            return(RedirectToAction("NotAttended"));
        }
Esempio n. 28
0
        /// <summary>
        /// 作业调度定时执行的方法
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public async Task Execute(IJobExecutionContext context)
        {
            ORDER order = new ORDER();

            order.UpdateOrderState();

            GROUP group = new GROUP();

            group.UpdateGroupState();
        }
Esempio n. 29
0
 public HttpResponseMessage Paid(int id)
 {
     using (MobileStoreServiceEntities db = new MobileStoreServiceEntities())
     {
         ORDER o = db.ORDERS.FirstOrDefault(or => or.ORDER_ID == id);
         o.PAID = 1;
         db.SaveChanges();
     }
     return(CreateResponse(HttpStatusCode.OK));
 }
Esempio n. 30
0
        public FmSaleDetail(int Id)
        {
            InitializeComponent();
            ORDER   order = db.ORDERS.Where(p => p.ID == Id).FirstOrDefault();
            PRODUCT prod  = db.PRODUCTs.Where(d => d.ID.Equals(order.PRODUCT)).FirstOrDefault();

            showData(order);
            showProductInfo(prod);
            Oid = Id;
        }
Esempio n. 31
0
	void OnGUI () 
	{
		GUILayout.Label ("Hierarchy Organizer", EditorStyles.boldLabel);

		if (GUILayout.Button ("Sort All Hierarchy"))
			EditorApplication.ExecuteMenuItem ("Tools/Sort Hierarchy");

		if (GUILayout.Button ("Sort Children of Selected"))
			EditorApplication.ExecuteMenuItem ("GameObject/Sort Children");

		GUILayout.Space (8);
		sortOrder = (ORDER)EditorGUILayout.EnumPopup("Sort Order", sortOrder);
		GUILayout.Space (8);
		autoSort = EditorGUILayout.Toggle ("Automatic Sorting", autoSort);
		GUILayout.Space (8);
		EditorGUILayout.HelpBox ("Automatic sorting may cause serious lag if you have a lot of objects in the scene.  Use with caution!", MessageType.Info);
	}
Esempio n. 32
0
        public static bool Insert(int userId, String fullName, String address, String tel, DateTime orrdertime,
                                  String note, int state, int totalpayent, int idCity, int idDistrict, List<int> foods,
                                  List<int> count)
        {
            //Khởi tạo một đối tượng ACCOUNT

            bool flag = true;

            _db = new FoodStoreEntities();

            int id = GetMaxId();
            ORDER currentorder = null;
            var orderdetails = new List<ORDERDETAIL>();
            ACCOUNT account = AccountController.GetById(userId, _db);
            CITY city = CityController.GetById(idCity, _db);
            DISTRICT district = DistrictController.GetById(idDistrict, _db);
            try
            {
                var order = new ORDER
                                {
                                    ID = id,
                                    ACCOUNT = account,
                                    Name = fullName,
                                    Tel = tel,
                                    Address = address,
                                    Date = orrdertime,
                                    Note = note,
                                    State = state,
                                    TotalPayment = totalpayent,
                                    DISTRICT = district,
                                    CITY = city
                                };

                _db.ORDERs.AddObject(order);
                _db.SaveChanges();

                int n = foods.Count();
                for (int i = 0; i < n; i++)
                {
                    int fId = foods[i];
                    FOOD food = FoodController.GetById(fId, _db);
                    currentorder = GetById(id, _db);
                    var orderdetail = new ORDERDETAIL
                                          {
                                              ID = OrderDetailController.GetMaxId(),
                                              ORDER = currentorder,
                                              FOOD = food,
                                              Count = count[i],
                                              TotalPayment = count[i]*food.Price,
                                              Price = food.Price
                                          };
                    orderdetails.Add(orderdetail);
                    _db.ORDERDETAILs.AddObject(orderdetail);
                    _db.SaveChanges();
                }

                _db.AcceptAllChanges();
            }
            catch (Exception)
            {
                flag = false;
                throw;
            }
            if (flag)
            {
                StringBuilder body = new StringBuilder()
                    .AppendLine("A new order has been submitted")
                    .AppendLine("---")
                    .AppendLine("Items:");

                foreach (ORDERDETAIL i in orderdetails)
                {
                    int? subtotal = i.Price*i.Count;
                    body.AppendFormat("{0} x {1} (subtotal: {2:c})", i.Count,
                                      i.FOOD.Name,
                                      subtotal).AppendLine();
                }

                body.AppendLine()
                    .AppendFormat("Total order value: {0:c}", ((int)currentorder.TotalPayment).ToString("c"))
                    .AppendLine("---")
                    .AppendLine("Ship to:")
                    .AppendLine(currentorder.Name)
                    .AppendLine(currentorder.Note)
                    .AppendLine(currentorder.Tel)
                    .AppendLine(currentorder.Address)
                    .AppendLine(currentorder.DISTRICT.Name)
                    .AppendLine(currentorder.CITY.Name)
                    .AppendLine("---");

                Mail.SendOrderDetail(currentorder.Note, currentorder.Name, body);
            }

            return flag;
        }