示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ShipVia shipvia = db.ShipVias.Find(id);

            db.ShipVias.Remove(shipvia);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
        //
        // GET: /ShipViaAdmin/Details/5

        public ActionResult Details(int id = 0)
        {
            ShipVia shipvia = db.ShipVias.Find(id);

            if (shipvia == null)
            {
                return(HttpNotFound());
            }
            return(View(shipvia));
        }
示例#3
0
 public ActionResult Edit(ShipVia shipvia)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shipvia).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(shipvia));
 }
        public ActionResult Create(ShipVia shipvia)
        {
            if (ModelState.IsValid)
            {
                db.ShipVias.Add(shipvia);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(shipvia);
        }
示例#5
0
        public ActionResult Create(ShipVia shipvia)
        {
            if (ModelState.IsValid)
            {
                db.ShipVias.Add(shipvia);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(shipvia));
        }
示例#6
0
        public override int GetHashCode()
        {
            var hashCode = 84649274;

            hashCode = hashCode * -1521134295 + OrderID.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CustomerID);

            hashCode = hashCode * -1521134295 + EmployeeID.GetHashCode();
            hashCode = hashCode * -1521134295 + OrderDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(RequiredDate);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ShippedDate);

            hashCode = hashCode * -1521134295 + ShipVia.GetHashCode();
            hashCode = hashCode * -1521134295 + Freight.GetHashCode();
            return(hashCode);
        }
示例#7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (CustomerId != null ? CustomerId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ EmployeeId;
         hashCode = (hashCode * 397) ^ OrderDate.GetHashCode();
         hashCode = (hashCode * 397) ^ RequiredDate.GetHashCode();
         hashCode = (hashCode * 397) ^ ShippedDate.GetHashCode();
         hashCode = (hashCode * 397) ^ ShipVia.GetHashCode();
         hashCode = (hashCode * 397) ^ Freight.GetHashCode();
         hashCode = (hashCode * 397) ^ (ShipName != null ? ShipName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipAddress != null ? ShipAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipCity != null ? ShipCity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipRegion != null ? ShipRegion.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipPostalCode != null ? ShipPostalCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipCountry != null ? ShipCountry.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#8
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (Customer != null ? Customer.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Employee != null ? Employee.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ OrderDate.GetHashCode();
         hashCode = (hashCode * 397) ^ RequiredDate.GetHashCode();
         hashCode = (hashCode * 397) ^ ShippedDate.GetHashCode();
         hashCode = (hashCode * 397) ^ ShipVia.GetHashCode();
         hashCode = (hashCode * 397) ^ Freight.GetHashCode();
         hashCode = (hashCode * 397) ^ (ShipName != null ? ShipName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipAddress != null ? ShipAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipCity != null ? ShipCity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipRegion != null ? ShipRegion.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipPostalCode != null ? ShipPostalCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShipCountry != null ? ShipCountry.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OrderDetails != null ? OrderDetails.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntIds != null ? IntIds.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CharMap != null ? CharMap.GetHashCode() : 0);
         return(hashCode);
     }
 }
 private bool CheckShipVia(string shipVia)
 {
     return(string.IsNullOrWhiteSpace(ShipVia) ? string.IsNullOrWhiteSpace(shipVia) :
            !string.IsNullOrWhiteSpace(shipVia) && ShipVia.ToUpper().Contains(shipVia.ToUpper()));
 }
示例#10
0
        public CustomerOrder CreateNewCart(IUnitOfWork unitOfWork, OrderHistory customerOrder, AddRmaParameter parameter, AddRmaResult result)
        {
            var orderNumber = string.Empty;

            if (string.IsNullOrEmpty(customerOrder.WebOrderNumber) && !string.IsNullOrEmpty(customerOrder.ErpOrderNumber))
            {
                orderNumber = customerOrder.ErpOrderNumber.Split('-')[0];
            }
            else
            {
                orderNumber = customerOrder.WebOrderNumber.Substring(0, 1) == "W" ? customerOrder.WebOrderNumber.Substring(1) : customerOrder.WebOrderNumber.Split('-')[0];
            }

            Customer customer = new Customer();

            if (string.IsNullOrEmpty(customerOrder.CustomerSequence) || customerOrder.CustomerSequence.Equals(customerOrder.CustomerNumber))
            {
                customer = unitOfWork.GetRepository <Customer>().GetTable().Where(x => x.CustomerNumber == customerOrder.CustomerNumber).FirstOrDefault();
            }
            else
            {
                customer = unitOfWork.GetRepository <Customer>().GetTable().Where(x => x.CustomerNumber == customerOrder.CustomerNumber && x.CustomerSequence == customerOrder.CustomerSequence).FirstOrDefault();
            }

            SiteContextDto siteContextDto = new SiteContextDto(SiteContext.Current);
            var            websiteId      = siteContextDto.Website.Id;
            var            website        = siteContextDto.Website;

            Salesperson salesperson = new Salesperson();

            salesperson = unitOfWork.GetRepository <Salesperson>().GetTable().Where(x => x.Name.Equals(customerOrder.Salesperson)).FirstOrDefault();

            ShipVia shipVia = unitOfWork.GetRepository <ShipVia>().GetTable().Where(x => x.ShipCode.ToLower().Equals(customerOrder.ShipCode.ToLower())).FirstOrDefault();

            CustomerOrder cart = new CustomerOrder()
            {
                Id              = new Guid(),
                OrderNumber     = customSettings.RMA_OrderNumberPrefix + orderNumber,
                OrderDate       = DateTimeProvider.Current.Now,
                Customer        = customer,
                WebsiteId       = websiteId,
                Website         = website,
                Status          = "Return Requested",
                CustomerPO      = customerOrder.CustomerPO,
                Notes           = customerOrder.Notes,
                Type            = "Return Requested",
                Salesperson     = salesperson,
                SalespersonId   = salesperson.Id,
                ShippingCharges = customerOrder.ShippingCharges,
                ShipCode        = customerOrder.ShipCode,
                ShipVia         = shipVia
            };

            foreach (var promotion in customerOrder.OrderHistoryPromotions.ToList())
            {
                CustomerOrderPromotion orderPromotion = new CustomerOrderPromotion()
                {
                    Id = new Guid(),
                    CustomerOrderId  = cart.Id,
                    PromotionId      = promotion.PromotionId,
                    OrderLineId      = promotion.OrderHistoryLineId,
                    Amount           = promotion.Amount,
                    CustomProperties = promotion.CustomProperties
                };
                cart.CustomerOrderPromotions.Add(orderPromotion);
            }

            this.CartPipeline.SetBillTo(new SetBillToParameter()
            {
                Cart   = cart,
                BillTo = cart.Customer
            });

            this.CartPipeline.SetShipTo(new SetShipToParameter()
            {
                Cart   = cart,
                ShipTo = cart.ShipTo
            });

            // Add the Returned Sequence in the Order Number
            var returnedSeq = unitOfWork.GetRepository <CustomerOrder>().GetTable().Where(x => x.OrderNumber.StartsWith(cart.OrderNumber)).Count();

            if (returnedSeq != 0)
            {
                returnedSeq += 1;
            }
            else
            {
                returnedSeq = 1;
            }
            cart.OrderNumber = cart.OrderNumber + "/" + returnedSeq;

            // Getting the Invoice Number
            var invoiceNumber = string.Empty;

            if (!string.IsNullOrEmpty(result.OrderHistory.ErpOrderNumber))
            {
                var erpNumber    = result.OrderHistory.ErpOrderNumber.Split('-')[0];
                var invoiceQuery = (from ih in unitOfWork.GetRepository <InvoiceHistory>().GetTable()
                                    join ihl in unitOfWork.GetRepository <InvoiceHistoryLine>().GetTable()
                                    on ih.Id equals ihl.InvoiceHistoryId
                                    where ihl.ErpOrderNumber == erpNumber
                                    select ih.InvoiceNumber);
                if (!string.IsNullOrEmpty(invoiceQuery.FirstOrDefault()))
                {
                    invoiceNumber = invoiceQuery.FirstOrDefault().Split('-')[0].ToString();
                }
            }

            foreach (var customProperty in customerOrder.CustomProperties)
            {
                cart.SetProperty(customProperty.Name, customProperty.Value);
            }

            var chkReturnType = 0; // To check partial return or full return based on quantity return

            foreach (var ol in customerOrder.OrderHistoryLines.ToList())
            {
                RmaLineDto rmaLineDto = parameter.RmaLines.FirstOrDefault((RmaLineDto r) => r.Line.Equals(ol.LineNumber)) ?? new RmaLineDto();
                if (rmaLineDto.RmaQtyRequested != 0)
                {
                    AddCartLineParameter addCartLineParameter = new AddCartLineParameter();
                    addCartLineParameter.Cart             = cart;
                    addCartLineParameter.Product          = unitOfWork.GetRepository <Product>().GetTable().Where(x => x.Name.Equals(ol.ProductErpNumber)).FirstOrDefault();
                    addCartLineParameter.QtyOrdered       = rmaLineDto.RmaQtyRequested;
                    addCartLineParameter.UnitOfMeasure    = ol.UnitOfMeasure;
                    addCartLineParameter.Notes            = ol.Notes;
                    addCartLineParameter.CustomProperties = ol.CustomProperties.ToList();

                    Insite.Cart.Services.Pipelines.Results.AddCartLineResult addCartLineResult = CartPipeline.AddCartLine(addCartLineParameter);
                    addCartLineResult.CartLine.UnitCost          = ol.UnitCost;
                    addCartLineResult.CartLine.UnitListPrice     = addCartLineParameter.Product.BasicListPrice;
                    addCartLineResult.CartLine.UnitNetPrice      = ol.UnitNetPrice;
                    addCartLineResult.CartLine.UnitRegularPrice  = ol.UnitRegularPrice;
                    addCartLineResult.CartLine.TotalNetPrice     = ol.TotalNetPrice;
                    addCartLineResult.CartLine.TotalRegularPrice = ol.TotalRegularPrice;

                    if (ol.QtyOrdered > rmaLineDto.RmaQtyRequested)
                    {
                        chkReturnType += 1;
                    }
                }
            }

            if (chkReturnType != 0 || customerOrder.OrderHistoryLines.Count() > cart.OrderLines.Count())
            {
                cart.Notes = invoiceNumber + "/" + 1; // 1 indicates the partial return
            }
            else
            {
                cart.Notes = invoiceNumber + "/" + 0; // 0 indicates the full return
            }

            unitOfWork.GetRepository <CustomerOrder>().Insert(cart);
            unitOfWork.Save();

            return(cart);
        }
 public ActionResult Edit(ShipVia shipvia)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shipvia).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(shipvia);
 }
示例#12
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (OrderID != 0)
            {
                hash ^= OrderID.GetHashCode();
            }
            if (CustomerID.Length != 0)
            {
                hash ^= CustomerID.GetHashCode();
            }
            if (EmployeeID != 0)
            {
                hash ^= EmployeeID.GetHashCode();
            }
            if (orderDate_ != null)
            {
                hash ^= OrderDate.GetHashCode();
            }
            if (requiredDate_ != null)
            {
                hash ^= RequiredDate.GetHashCode();
            }
            if (shippedDate_ != null)
            {
                hash ^= ShippedDate.GetHashCode();
            }
            if (ShipVia != 0)
            {
                hash ^= ShipVia.GetHashCode();
            }
            if (Freight != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Freight);
            }
            if (ShipName.Length != 0)
            {
                hash ^= ShipName.GetHashCode();
            }
            if (ShipAddress.Length != 0)
            {
                hash ^= ShipAddress.GetHashCode();
            }
            if (ShipCity.Length != 0)
            {
                hash ^= ShipCity.GetHashCode();
            }
            if (ShipRegion.Length != 0)
            {
                hash ^= ShipRegion.GetHashCode();
            }
            if (ShipPostalCode.Length != 0)
            {
                hash ^= ShipPostalCode.GetHashCode();
            }
            if (ShipCountry.Length != 0)
            {
                hash ^= ShipCountry.GetHashCode();
            }
            hash ^= lines_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#13
0
 public void ShipViaChanged(ShipVia entity, UpdateOperations operation)
 {
     CheckIsAdminOrSystem();
 }