Exemple #1
0
        public ActionResult Create()
        {
            CMS_OrderAdminModels model = new CMS_OrderAdminModels();

            model.Items = _facPro.GetList().Select(o => new CMS_ItemModels {
                Price       = o.ProductPrice,
                ProductID   = o.Id,
                ProductName = o.ProductName,
            }).OrderBy(o => o.ProductName).ToList();

            model.Customers = _facCus.GetList().Select(o => new CMS_CustomerAnonymousModels
            {
                FirstName = o.FirstName,
                LastName  = o.LastName,
                Address   = o.Address,
                Id        = o.ID,
                City      = o.City,
                Company   = o.CompanyName,
                Country   = o.Country,
                Email     = o.Email,
                Phone     = o.Phone,
                PostCode  = o.Postcode
            }).OrderBy(o => o.Name).ToList();
            model.Discounts = _facDiscount.GetList();
            model.Employees = _facEmp.GetList();
            return(PartialView("_Create", model));
        }
Exemple #2
0
        public JsonResult Create(CMS_OrderAdminModels Order)
        {
            var status = 200;

            try
            {
                var model = new CMS_CheckOutModels
                {
                    CreatedUser  = CurrentUser.UserId,
                    ModifiedUser = CurrentUser.UserId,
                    Customer     = new CMS_DTO.CMSCustomer.CMS_CustomerAnonymousModels
                    {
                        Address     = Order.Address,
                        City        = Order.City,
                        Company     = Order.Company,
                        Country     = Order.Country,
                        Description = Order.Description,
                        Email       = Order.Email,
                        FirstName   = Order.FirstName,
                        LastName    = Order.LastName,
                        Phone       = Order.Phone,
                        Id          = Order.Id
                    },
                    TotalPrice    = Order.TotalPrice,
                    TotalDiscount = Order.TotalDiscount,
                    SubTotalPrice = Order.SubTotal,
                    ListItem      = Order.Items,
                    IsTemp        = false //admin
                };
                if (model != null && model.ListItem != null && model.ListItem.Any() && !string.IsNullOrEmpty(Order.DiscountID))
                {
                    model.ListItem.Add(new CMS_ItemModels
                    {
                        DiscountID    = Order.DiscountID,
                        DiscountType  = Order.DiscountType,
                        DiscountValue = Order.DiscountValue
                    });
                }
                var OrderId = string.Empty;
                var result  = _fac.CreateOrder(model, ref OrderId);
                if (!result)
                {
                    status = 500;
                }
            }
            catch (Exception ex)
            {
                NSLog.Logger.Error("Create_Error : ", ex);
            }
            var obj = new
            {
                Status = status,
            };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create()
        {
            CMS_OrderAdminModels model = new CMS_OrderAdminModels();

            model.Items = _facPro.GetList().Select(o => new CMS_ItemModels
            {
                Price       = o.ProductPrice,
                ProductID   = o.Id,
                ProductName = o.ProductName,
            }).OrderBy(o => o.ProductName).ToList();
            return(PartialView("_Create", model));
        }
        public JsonResult Create(CMS_OrderAdminModels Order)
        {
            var status = 200;

            try
            {
                var model = new CMS_CheckOutModels
                {
                    CreatedUser  = CurrentUser.UserName,
                    ModifiedUser = CurrentUser.UserName,
                    Customer     = new CMS_DTO.CMSCustomer.CMS_CustomerAnonymousModels
                    {
                        Address     = Order.Address,
                        City        = Order.City,
                        Company     = Order.Company,
                        Country     = Order.Country,
                        Description = Order.Description,
                        Email       = Order.Email,
                        FirstName   = Order.FirstName,
                        LastName    = Order.LastName,
                        Phone       = Order.Phone,
                        Id          = Order.Id
                    },
                    ListItem   = Order.Items,
                    OrderType  = (byte)CMS_Common.Commons.EOrderType.Expense,
                    TotalPrice = Order.Items != null?Order.Items.Sum(o => o.TotalPrice) : 0,
                                     SubTotalPrice = Order.Items != null?Order.Items.Sum(o => o.TotalPrice) : 0,
                                                         IsTemp = false //admin
                };
                var OrderId = string.Empty;
                var result  = _fac.CreateOrder(model, ref OrderId);
                if (!result)
                {
                    status = 500;
                }
            }
            catch (Exception ex)
            {
                NSLog.Logger.Error("Create_Error : ", ex);
            }
            var obj = new
            {
                Status = status,
            };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }