Inheritance: System.Web.UI.Page
コード例 #1
0
        public ViewOrder Get(int id)
        {
            //Order order = _repository.Orders.FirstOrDefault(o => o.Id == id);
            Order order = _repository.Get(id);

            return(ViewOrder.ToViewModel(order));
        }
コード例 #2
0
 public Result Pay(ViewOrder vo)
 {
     return(new Result()
     {
         Code = 0, Message = "ok", Obj = vo
     });
 }
コード例 #3
0
        private void TextCell_Tapped(object sender, EventArgs e)
        {
            var tc = ((TextCell)sender);

            listOrders.SelectedItem = null;
            string order = tc.Text;

            string[] split = order.Split(':');

            FileManager fileManager = new FileManager();

            Order[] lstOrders = fileManager.LoadOrders();

            for (int i = 0; i < lstOrders.Length; i++)
            {
                if (lstOrders[i].ID == split[0])
                {
                    ViewOrder viewOrder = new ViewOrder(lstOrders[i])
                    {
                        Title = "Order"
                    };
                    Navigation.PushAsync(viewOrder);
                }
            }
        }
コード例 #4
0
        private ViewOrder XmlOrderToViewOrder(OrderType xmlOrder)
        {
            var viewOrder = new ViewOrder()
            {
                ReferenceID         = xmlOrder.Header.References.FirstOrDefault().ReferenceID,
                PurchaseOrderNumber = xmlOrder.Header.OrderHeader.PurchaseOrderNumber,
                PurchaseOrderDate   = xmlOrder.Header.OrderHeader.PurchaseOrderDateSpecified
                    ? xmlOrder.Header.OrderHeader.PurchaseOrderDate.ToShortDateString()
                    : string.Empty,
                TradingPartnerId = xmlOrder.Header.OrderHeader.TradingPartnerId,
                LineItems        = new List <LineItem>()
            };


            foreach (var lineItem in xmlOrder.LineItem)
            {
                viewOrder.LineItems.Add(
                    new LineItem()
                {
                    SequenceNumber      = lineItem.OrderLine.LineSequenceNumber,
                    BuyerPartNumber     = lineItem.OrderLine.BuyerPartNumber,
                    ConsumerPackageCode = lineItem.OrderLine.ConsumerPackageCode,
                    OrderQty            = lineItem.OrderLine.OrderQty,
                    OrderQtyUOM         = lineItem.OrderLine.OrderQtyUOM.ToString(),
                    PurchasePrice       = lineItem.OrderLine.PurchasePrice,
                    VendorPartNumber    = lineItem.OrderLine.VendorPartNumber,
                    ShipDate            = lineItem.OrderLine.ShipDateSpecified
                            ? lineItem.OrderLine.ShipDate.ToShortDateString()
                            : string.Empty
                });
            }

            return(viewOrder);
        }
コード例 #5
0
        private void ViewOrders_Click(object sender, RoutedEventArgs e)
        {
            ViewOrder         nextPage   = new ViewOrder();
            NavigationService navService = NavigationService.GetNavigationService(this);

            navService.Navigate(nextPage);
        }
コード例 #6
0
        WxPayData GetWXPayData(ViewOrder vo, out string out_trade_no)
        {
            //vo = new OrderServiceClient().Get(id, user.Uid);
            if (vo.Id > 0)
            {
                ViewClass vc   = new ClassServiceClient().Get(vo.ClassId);
                WxPayData data = new WxPayData();
                data.SetValue("device_info", "WEB");
                data.SetValue("body", vc.Name);
                data.SetValue("detail", vc.Name + " " + vo.Number);
                data.SetValue("attach", vo.Id);
                out_trade_no = WxPayApi.GenerateOutTradeNo(vo.Id, vo.CreateTime);
                data.SetValue("out_trade_no", out_trade_no);
                data.SetValue("time_start", vo.CreateTime.ToString("yyyyMMddHHmmss")); //交易起始时间
                data.SetValue("time_expire", vo.CreateTime.AddMinutes(CommonInfo.Order_Timeout).ToString("yyyyMMddHHmmss"));
                data.SetValue("total_fee", (int)vo.Amount * 100);                      //微信钱的单位是分
                data.SetValue("trade_type", "NATIVE");
                data.SetValue("product_id", vc.Id);

                return(data);
            }
            else
            {
                out_trade_no = "";
                return(null);
            }
        }
コード例 #7
0
        public ViewOrder Get(int classID, int userID)
        {
            //Order order = _repository.Orders.FirstOrDefault(o => o.Id == classID && userID == o.UserId);
            Order order = _repository.Orders.FirstOrDefault(o => o.ClassId == classID && userID == o.UserId);

            return(ViewOrder.ToViewModel(order));
        }
コード例 #8
0
        public Result Add(ViewOrder order)
        {
            Order _order = ViewOrder.ToEntity(order);

            _order = _repository.Add(_order);
            return(new Result(0, "", ViewOrder.ToViewModel(_order)));
        }
コード例 #9
0
        public async Task <ViewOrder[]> UpdateOrderAsync(ViewOrder updatedViewOrder, bool returnNewList)
        {
            using (DataDbContext context = new DataDbContext())
            {
                var existingOrder = context.Orders.SingleOrDefault(x => x.Id == updatedViewOrder.Id);
                if (existingOrder != null)
                {
                    Order updatedOrder = new Order
                    {
                        Id            = updatedViewOrder.Id,
                        OnDate        = updatedViewOrder.OnDate,
                        CustomerId    = updatedViewOrder.CustomerId,
                        ShipFirstName = updatedViewOrder.ShipFirstName,
                        ShipLastName  = updatedViewOrder.ShipLastName,
                        ShipStreet    = updatedViewOrder.ShipStreet,
                        ShipCity      = updatedViewOrder.ShipCity,
                        ShipState     = updatedViewOrder.ShipState,
                        ShipZip       = updatedViewOrder.ShipZip,
                        Campaign      = updatedViewOrder.Campaign,
                        Subtotal      = updatedViewOrder.Subtotal,
                        Tax           = updatedViewOrder.Tax,
                        ShipHand      = updatedViewOrder.ShipHand,
                        Total         = updatedViewOrder.Total,
                        Deferred      = updatedViewOrder.Deferred,
                        Done          = updatedViewOrder.Done
                    };
                    //existingOrder = updatedOrder;
                    context.Entry(existingOrder).CurrentValues.SetValues(updatedViewOrder);

                    //order items: out with the old
                    OrderItem[] existingOrderItems = context.OrderItems.Where(x => x.OrderId == updatedViewOrder.Id).ToArray();
                    context.OrderItems.RemoveRange(existingOrderItems);

                    //and in with the new
                    List <OrderItem> updatedOrderItems = new List <OrderItem>();
                    foreach (ViewOrderItem item in updatedViewOrder.Items)
                    {
                        updatedOrderItems.Add(new OrderItem
                        {
                            OrderId   = updatedViewOrder.Id,
                            ProductId = item.ProductId,
                            UnitPrice = item.UnitPrice,
                            Quantity  = item.Quantity,
                            LineTotal = item.LineTotal
                        });
                    }
                    context.OrderItems.AddRange(updatedOrderItems);
                    context.SaveChanges();
                }
                if (returnNewList)
                {
                    return(await GetOrdersAsync());
                }
                else
                {
                    return(null);
                }
            }     //using
        }
コード例 #10
0
ファイル: OrderController.cs プロジェクト: Obitox/restaurant
        public async Task <IActionResult> Index(ViewOrder order)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var items = new List <Item>();

            if (order.Cart.Items.Count > 0)
            {
                foreach (var cartItem in order.Cart.Items)
                {
                    var item = new Item
                    {
                        ItemId   = cartItem.Id,
                        Title    = cartItem.Title,
                        CartItem = new List <CartItem>
                        {
                            new CartItem
                            {
                                ItemId             = cartItem.Id,
                                Amount             = cartItem.Amount,
                                PersonalPreference = cartItem.PersonalPreference,
                                PortionId          = cartItem.Portion.Id
                            }
                        }
                    };
                    items.Add(item);
                }
            }

            var meals = new List <Meal>();

            if (order.Cart.Meals.Count > 0)
            {
                foreach (var cartMeal in order.Cart.Meals)
                {
                    var meal = new Meal
                    {
                        MealId   = cartMeal.MealId,
                        Title    = cartMeal.Title,
                        CartMeal = new List <CartMeal> {
                            new CartMeal
                            {
                                MealId             = cartMeal.MealId,
                                Amount             = cartMeal.Amount,
                                PersonalPreference = cartMeal.PersonalPreference
                            }
                        }
                    };
                    meals.Add(meal);
                }
            }

            var orderNew = await _orderService.Process(14, 1, items, meals, order.Price);

            return(Ok(orderNew));
        }
コード例 #11
0
        public ActionResult OrderHistoryDetails(long id)
        {
            ViewOrder viewOrder = _iOrderManager.GetOrderByDeliveryId(id);
            var       order     = _iOrderManager.GetOrderHistoryByOrderId(viewOrder.OrderId);

            order.Client = _iClientManager.GetById(order.ClientId);
            return(PartialView("_ViewOrderHistoryPartialPage", order));
        }
コード例 #12
0
        private void button2_Click(object sender, EventArgs e)
        {
            sidePanel.Height = btnView.Height;
            sidePanel.Top    = btnView.Top;

            ViewOrder o = new ViewOrder(_username);

            o.ShowDialog();
        }
コード例 #13
0
        public JsonResult Create([FromBody] ViewOrder theViewUser)
        {
            Order theUser = new Order(theViewUser);

            _orderRepository.Insert(theUser);
            _orderRepository.Save();

            return(Json(_orderRepository.GetAll()));;
        }
コード例 #14
0
        public async Task <ViewOrder[]> AddOrderAsync(ViewOrder newViewOrder, bool returnNewList)
        {
            using (DataDbContext context = new DataDbContext())
            {
                Order newOrder = new Order
                {
                    Id                = newViewOrder.Id,
                    OnDate            = newViewOrder.OnDate,
                    CustomerId        = newViewOrder.CustomerId,
                    ShipFirstName     = newViewOrder.ShipFirstName,
                    ShipLastName      = newViewOrder.ShipLastName,
                    ShipStreet        = newViewOrder.ShipStreet,
                    ShipCity          = newViewOrder.ShipCity,
                    ShipState         = newViewOrder.ShipState,
                    ShipZip           = newViewOrder.ShipZip,
                    Campaign          = newViewOrder.Campaign,
                    Subtotal          = newViewOrder.Subtotal,
                    Tax               = newViewOrder.Tax,
                    ShipHand          = newViewOrder.ShipHand,
                    CardLastFour      = newViewOrder.CardLastFour,
                    TransactionId     = newViewOrder.TransactionId,
                    ResponseCode      = newViewOrder.ResponseCode,
                    AuthorizationCode = newViewOrder.AuthorizationCode,
                    Total             = newViewOrder.Total,
                    Deferred          = newViewOrder.Deferred,
                    Done              = newViewOrder.Done
                };
                context.Orders.Add(newOrder);
                context.SaveChanges();
                //now that we have saved, the database has generated an id that we can access, to create a parent reference for OrderItems
                int orderid = newOrder.Id;

                List <OrderItem> dbOrderItems = new List <OrderItem>();
                foreach (ViewOrderItem item in newViewOrder.Items)
                {
                    dbOrderItems.Add(new OrderItem
                    {
                        OrderId   = orderid,
                        ProductId = item.ProductId,
                        UnitPrice = item.UnitPrice,
                        Quantity  = item.Quantity,
                        LineTotal = item.LineTotal
                    });
                }
                context.OrderItems.AddRange(dbOrderItems);
                context.SaveChanges();
                if (returnNewList)
                {
                    return(await GetOrdersAsync());
                }
                else
                {
                    return(null);
                }
            }     //using
        }
コード例 #15
0
        public JsonResult Update([FromBody] ViewOrder theViewUser)
        {
            Order theUser = new Order(theViewUser);

            _orderRepository.Update(theUser);
            _orderRepository.Save();
            var allOrders = _orderRepository.GetById(theUser.Id);

            return(Json(allOrders));
        }
コード例 #16
0
        public List <ViewOrder> GetOrder(string whereStr, int page, int pagesize, out int count)
        {
            List <Order>     list  = _repository.GetOrder(whereStr, page, pagesize, out count);
            List <ViewOrder> model = new List <ViewOrder>();

            foreach (var item in list)
            {
                model.Add(ViewOrder.ToViewModel(item));
            }
            return(model);
        }
コード例 #17
0
        public string ApproveOrderByAdmin(ViewOrder order)
        {
            int rowAffected = _iOrderGateway.ApproveOrderByAdmin(order);

            if (rowAffected > 0)
            {
                return("Approved by Admin Successfully!");
            }

            return("Failed to approve by Admin");
        }
コード例 #18
0
 public Order(ViewOrder theViewOrder)
 {
     UserId        = theViewOrder.UserId;
     Id            = theViewOrder.OrderId;
     Name          = theViewOrder.Name;
     TrackingID    = theViewOrder.TrackingID;
     StreetAddress = theViewOrder.StreetAddress;
     City          = theViewOrder.City;
     State         = theViewOrder.State;
     ZipCode       = theViewOrder.ZipCode;
 }
コード例 #19
0
        public List <ViewOrder> GetOrdersByuid(int uid)
        {
            List <Order>     list  = _repository.GetOrdersByuid(uid);
            List <ViewOrder> model = new List <ViewOrder>();

            foreach (var item in list)
            {
                model.Add(ViewOrder.ToViewModel(item));
            }
            return(model);
        }
コード例 #20
0
        //==========================================================



        //==========================================================
        public ActionResult Details(int?id)
        {
            ShopOrder order = db.ShopOrders
                              .Include(o => o.ApplicationUser)
                              .Include(o => o.ShopOrderProducts)
                              .Where(b => b.Id == id)
                              .SingleOrDefault();

            if (order == null)
            {
                return(HttpNotFound());
            }

            ViewOrder orderView = new ViewOrder
            {
                Id           = order.Id,
                DateCreation = order.DateCreate,
                UserFullName = order.ApplicationUser.UserProfile.Surname + " "
                               + order.ApplicationUser.UserProfile.Name + " "
                               + order.ApplicationUser.UserProfile.Patronymic,

                Passport = order.ApplicationUser.UserProfile.PassportNumberAndSeries
                           + ", выдан " + order.ApplicationUser.UserProfile.PassportIssuingDate.ToShortDateString()
            };

            //адрес
            orderView.Adress = FromBDToAdressString(
                order.ApplicationUser.UserProfile.Country,
                order.ApplicationUser.UserProfile.City,
                order.ApplicationUser.UserProfile.ZipCode,
                order.ApplicationUser.UserProfile.Street,
                order.ApplicationUser.UserProfile.House,
                order.ApplicationUser.UserProfile.Apartment);

            orderView.Products = new List <ViewOrderProduct>();
            foreach (ShopOrderProduct product in order.ShopOrderProducts)
            {
                orderView.PriceTotal = orderView.PriceTotal + product.Price;

                ViewOrderProduct productView = new ViewOrderProduct
                {
                    Name       = product.ShopProduct.Name,
                    Brand      = product.ShopProduct.ShopProductsBrand.Name,
                    VendorCode = product.ShopProduct.VendorCode,
                    Quantity   = product.Quantity,
                    PriceOne   = product.Price,
                    PriceAll   = product.Quantity * product.Price
                };

                orderView.Products.Add(productView);
            }

            return(View(orderView));
        }
コード例 #21
0
        public List <ViewOrder> GetClassId(int UserId)
        {
            List <Order> list = _repository.GetClassId(UserId);

            List <ViewOrder> model = new List <ViewOrder>();

            foreach (var item in list)
            {
                model.Add(ViewOrder.ToViewModel(item));
            }
            return(model);
        }
コード例 #22
0
        public void DisplayOrder(ViewOrders viewOrders, string selectedItem)
        {
            string[] split = selectedItem.Split(':');

            for (int i = 0; i < lstOrders.Length; i++)
            {
                if (lstOrders[i].ID == split[0])
                {
                    ViewOrder viewOrder = new ViewOrder(lstOrders[i]);
                    viewOrders.Navigation.PushAsync(viewOrder);
                }
            }
        }
コード例 #23
0
ファイル: AppController.cs プロジェクト: Vig1lante/EbookStore
        public AppController(DbEntities context)
        {
            this.Context  = context;
            Regcontroller = new RegistrationController(context);
            // Create anonymous user for adding items to cart before logging in
            User.Anonymous       = true;
            this.OrderController = new OrderController(context, this.User);
            this.ViewOrder       = new ViewOrder(context, OrderController);
            MainMenu MainMenu = new MainMenu(this);

            this.ViewUserPanel = new ViewUserPanel(this);
            ViewProduct        = new ViewProduct(context, MainMenu);
        }
コード例 #24
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteStartElement("moduleControl");
     WriteXmlInternal(writer);
     writer.WriteElementString("controlTitle", ControlTitle);
     writer.WriteElementString("controlType", ControlType.ToString());
     writer.WriteElementString("iconFile", IconFile);
     writer.WriteElementString("helpUrl", HelpURL);
     if (ViewOrder > Null.NullInteger)
     {
         writer.WriteElementString("viewOrder", ViewOrder.ToString());
     }
     writer.WriteEndElement();
 }
コード例 #25
0
        public Result Add(ViewOrder order)
        {
            Result result = CanApply(order.ClassId, order.Number);

            if (result.Code == 0)
            {
                ClassServiceClient cc = new ClassServiceClient();
                ViewClass          vc = cc.Get(order.ClassId);
                order.Amount = (double)vc.Price * order.Number;
                return(Impl.Add(order));
            }
            else
            {
                return(result);
            }
        }
コード例 #26
0
 /// <summary>
 /// WriteXml converts the object to Xml (serializes it) and writes it using the XmlWriter passed
 /// </summary>
 /// <remarks></remarks>
 /// <param name="writer">The XmlWriter that contains the xml for the object</param>
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteStartElement("Announcement");
     writer.WriteElementString("ItemID", ItemID.ToString(CultureInfo.InvariantCulture));
     writer.WriteElementString("ModuleID", ModuleID.ToString(CultureInfo.InvariantCulture));
     writer.WriteElementString("Title", Title);
     writer.WriteElementString("URL", URL);
     writer.WriteElementString("ViewOrder", ViewOrder.ToString(CultureInfo.InvariantCulture));
     writer.WriteElementString("Description", Description);
     writer.WriteElementString("ImageSource", ImageSource);
     writer.WriteElementString("TrackClicks", TrackClicks.ToString());
     writer.WriteElementString("NewWindow", NewWindow.ToString());
     writer.WriteElementString("PublishDate", PublishDate.ToString());
     writer.WriteElementString("ExpireDate", ExpireDate.ToString());
     writer.WriteEndElement();
 }
コード例 #27
0
        public int updateEntity(ViewOrder vo)
        {
            //var entity = dbSet.Find(vo.ID);

            //if (entity != null)
            //{
            //    Context.Entry(entity).State = System.Data.EntityState.Detached;
            //    //这个是在同一个上下文能修改的关键
            //}

            //entity = model;

            //Update(entity);
            _repository.updateEntity(ViewOrder.ToEntity(vo));
            return(_repository.Save());
        }
コード例 #28
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "sponsorid": // Int
                return(SponsorId.ToString(strFormat, formatProvider));

            case "conferenceid": // Int
                return(ConferenceId.ToString(strFormat, formatProvider));

            case "name": // NVarChar
                return(PropertyAccess.FormatString(Name, strFormat));

            case "url": // VarChar
                if (Url == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Url, strFormat));

            case "description": // NVarCharMax
                if (Description == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Description, strFormat));

            case "vieworder": // Int
                return(ViewOrder.ToString(strFormat, formatProvider));

            case "sponsorlevel": // NVarChar
                if (SponsorLevel == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(SponsorLevel, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
コード例 #29
0
ファイル: FAQsInfo.cs プロジェクト: EPTamminga/DNNFaq
        public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
        {
            PropertyNotFound = false;
            FAQsController faqController;

            switch (strPropertyName.ToLower())
            {
            case "question":
                return(PropertyAccess.FormatString(Question, strFormat));

            case "answer":
                return(PropertyAccess.FormatString(Answer, strFormat));

            case "user":
                UserInfo user = UserController.GetUserById(PortalSettings.Current.PortalId, Convert.ToInt32(CreatedByUser));
                return(PropertyAccess.FormatString(user.DisplayName, strFormat));

            case "viewcount":
                return(ViewCount.ToString(String.IsNullOrEmpty(strFormat) ? "g" : strFormat, formatProvider));

            case "vieworder":
                return(ViewOrder.ToString(String.IsNullOrEmpty(strFormat) ? "g" : strFormat, formatProvider));

            case "categoryname":
                faqController = new FAQsController();
                return(PropertyAccess.FormatString(faqController.GetCategory(CategoryId).FaqCategoryName, strFormat));

            case "categorydesc":
                faqController = new FAQsController();
                return(PropertyAccess.FormatString(faqController.GetCategory(CategoryId).FaqCategoryDescription, strFormat));

            case "datecreated":
                return(CreatedDate.ToString(String.IsNullOrEmpty(strFormat) ? "d" : strFormat, formatProvider));

            case "datemodified":
                return(DateModified.ToString(String.IsNullOrEmpty(strFormat) ? "d" : strFormat, formatProvider));

            case "index":
                return(Index.ToString(String.IsNullOrEmpty(strFormat) ? "g" : strFormat, formatProvider));

            default:
                PropertyNotFound = true;
                return(String.Empty);
            }
        }
コード例 #30
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Writes a ModuleControlInfo to an XmlWriter
        /// </summary>
        /// <param name="writer">The XmlWriter to use</param>
        /// -----------------------------------------------------------------------------
        public void WriteXml(XmlWriter writer)
        {
            //Write start of main elemenst
            writer.WriteStartElement("moduleControl");

            //write out properties
            WriteXmlInternal(writer);
            writer.WriteElementString("controlTitle", ControlTitle);
            writer.WriteElementString("controlType", ControlType.ToString());
            writer.WriteElementString("iconFile", IconFile);
            writer.WriteElementString("helpUrl", HelpURL);
            writer.WriteElementString("supportsPopUps", SupportsPopUps.ToString());
            if (ViewOrder > Null.NullInteger)
            {
                writer.WriteElementString("viewOrder", ViewOrder.ToString());
            }
            //Write end of main element
            writer.WriteEndElement();
        }