Esempio n. 1
0
        public ActionResult _OrderDetails(int?Id, string pageSessionToken)
        {
            ViewBag.cases       = false;
            ViewBag.setName     = "gridViewOrdDet";
            ViewBag.routeValues = new { Controller = "OrderDetail", Action = "_OrderDetails" };

            if (!String.IsNullOrEmpty(Request.Params["AccountId"]) && GaneStaticAppExtensions.ParseToNullableInt(Request.Params["AccountId"]) > 0)
            {
                var accountId = (int.Parse(Request.Params["AccountId"]));
                ViewBag.CurrencySymbol = AccountServices.GetAccountsById(accountId).GlobalCurrency.Symbol;
            }

            if (Id.HasValue && Id > 0)
            {
                ViewBag.setName     = "gridViewOrdDetEdit";
                ViewBag.OrderId     = Id.Value;
                ViewBag.routeValues = new { Controller = "OrderDetail", Action = "_OrderDetails", id = Id };
                var order = OrderService.GetOrderById(Id.Value);
                if (order != null)
                {
                    var sessionODList = GaneOrderDetailsSessionHelper.GetOrderDetailSession(pageSessionToken);
                    if (sessionODList == null || sessionODList.Count < 1 && !GaneOrderDetailsSessionHelper.IsDictionaryContainsKey(pageSessionToken))
                    {
                        var detailItems = order.OrderDetails.OrderBy(o => o.OrderDetailID).ToList();
                        sessionODList = AutoMapper.Mapper.Map(detailItems, sessionODList);
                    }
                    GaneOrderDetailsSessionHelper.SetOrderDetailSessions(pageSessionToken, sessionODList);
                    ViewBag.CurrencySymbol = order?.AccountCurrency?.Symbol;
                }
            }

            var model = GaneOrderDetailsSessionHelper.GetOrderDetailSession(pageSessionToken) ?? new List <OrderDetailSessionViewModel>();

            return(PartialView("_OrderDetails", model));
        }
Esempio n. 2
0
        public ActionResult ProcessOrder(int?id)
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var Order = OrderService.GetOrderById(id.Value);

            if (Order == null)
            {
                return(HttpNotFound());
            }
            VerifyOrderStatus(Order.OrderID);
            ViewBag.Consignments = new SelectList(OrderService.GetAllValidConsignmentTypes(CurrentTenantId), "ConsignmentTypeId", "ConsignmentType");
            var orderDto = new VModels.TransferOrderVM
            {
                OrderID                    = Order.OrderID,
                OrderNumber                = Order.OrderNumber,
                DeliveryNumber             = GaneStaticAppExtensions.GenerateDateRandomNo(),
                Type                       = Order.TransactionType.InventoryTransactionTypeId,
                InventoryTransactionTypeId = Order.TransactionType.InventoryTransactionTypeId,
                Warehouse                  = Order.TransactionType.InventoryTransactionTypeId == (int)InventoryTransactionTypeEnum.TransferIn ? Order.TransferWarehouse.WarehouseName : Order.TransferWarehouse.WarehouseName
            };

            return(View(orderDto));
        }
Esempio n. 3
0
        public ActionResult ReceivePO(int?id)
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Order order = OrderService.GetOrderById(id.Value);

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

            var orderDto = Mapper.Map(order, new ReceivePOVM());

            VerifyOrderStatus(order.OrderID);
            orderDto.DeliveryNumber             = GaneStaticAppExtensions.GenerateDateRandomNo();
            orderDto.InventoryTransactionTypeId = (int)InventoryTransactionTypeEnum.PurchaseOrder;
            if (TempData["AutoCompleteError"] != null)
            {
                ViewBag.Warning = TempData["AutoCompleteError"].ToString();
            }
            return(View(orderDto));
        }
Esempio n. 4
0
        public bool AuthoriseUser(string uname, string upass)
        {
            IApplicationContext context = DependencyResolver.Current.GetService <IApplicationContext>();

            context.Configuration.ProxyCreationEnabled = false;
            context.Configuration.LazyLoadingEnabled   = false;

            upass = GaneStaticAppExtensions.GetMd5(upass);

            if (HttpContext.Current.Session["caTenant"] == null)
            {
                // set error details
                caError error = new caError();
                error.ErrorTtile   = "Client not validated";
                error.ErrorMessage = "Sorry, system is unable to validate client";
                error.ErrorDetail  = "Either client is not registered, inactive or ambiguous, please contact support";

                HttpContext.Current.Session["caError"]  = error;
                HttpContext.Current.Session["ErrorUrl"] = "~/error";
            }

            else
            {
                caTenant tenant = (caTenant)HttpContext.Current.Session["caTenant"];
                TenantId = tenant.TenantId;
            }

            var Users = context.AuthUsers.AsNoTracking().Where(e => e.UserName.Equals(uname, StringComparison.CurrentCultureIgnoreCase) && e.UserPassword == upass.Trim() && e.TenantId == TenantId && e.IsActive && e.IsDeleted != true)
                        .Include(x => x.AuthPermissions.Select(y => y.AuthActivity))
                        .ToList();

            if (Users.Any() && Users.Count() < 2)
            {
                var user = Users.FirstOrDefault();

                UserId          = user.UserId;
                UserName        = user.UserName;
                UserFirstName   = user.UserFirstName;
                UserLastName    = user.UserLastName;
                UserEmail       = user.UserEmail;
                DateCreated     = user.DateCreated;
                DateUpdated     = user.DateUpdated;
                CreatedBy       = user.CreatedBy;
                UpdatedBy       = user.UpdatedBy;
                IsActive        = user.IsActive;
                IsDeleted       = user.IsDeleted;
                TenantId        = user.TenantId;
                AuthPermissions = user.AuthPermissions;
                SuperUser       = user.SuperUser;
                UserCulture     = user.UserCulture;
                UserTimeZoneId  = user.UserTimeZoneId;

                AuthUserStatus = true;
            }

            return(AuthUserStatus);
        }
        public ActionResult Create([Bind(Include = "UserName,UserPassword,UserFirstName,UserLastName,UserEmail,IsActive")] AuthUser authuser)
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }

            if (ModelState.IsValid)
            {
                // change user password into MD5 hash value
                authuser.UserPassword = GaneStaticAppExtensions.GetMd5(authuser.UserPassword);

                _userService.SaveAuthUser(authuser, CurrentUserId, CurrentTenantId);

                return(RedirectToAction("Index"));
            }

            return(View(authuser));
        }
 public ActionResult DispatchPallets(PalletDispatchViewModel model)
 {
     model.AllVehicles = _marketServices.GetAllValidMarketVehicles(CurrentTenantId).MarketVehicles
                         .Select(m => new SelectListItem()
     {
         Text = m.Name, Value = m.Id.ToString()
     });
     model.AllDrivers = _employeeServices.GetAllEmployees(CurrentTenantId)
                        .Select(m => new SelectListItem()
     {
         Text = m.Name, Value = m.ResourceId.ToString()
     });
     model.AllSentMethods = _palletingService.GetAllSentMethods()
                            .Select(m => new SelectListItem()
     {
         Text = m.Name, Value = m.SentMethodID.ToString()
     });
     model.DispatchRefrenceNumber       = GaneStaticAppExtensions.GenerateDateRandomNo();
     ViewBag.ControllerName             = "Pallets";
     Session["UploadedPalletEvidences"] = null;
     return(PartialView("_PalletDisptachDetail", model));
 }
        public ActionResult GoodsReturn()
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }
            //var products = (from prds in _productServices.GetAllValidProductMasters(CurrentTenantId).ToList()
            //                select new
            //                {
            //                    prds.ProductId,
            //                    prds.SKUCode,
            //                    prds.NameWithCode
            //                }).ToList();
            //ViewBag.grProducts = new SelectList(products, "ProductId", "NameWithCode");
            Guid guid = Guid.NewGuid();

            ViewBag.DeliveryNo = GaneStaticAppExtensions.GenerateDateRandomNo();
            ViewBag.groupToken = guid.ToString();


            return(View());
        }
Esempio n. 8
0
        public void UpdateAuthUser(AuthUser user, int userId, int tenantId)
        {
            user.UpdateUpdatedInfo(userId);
            _currentDbContext.AuthUsers.Attach(user);
            var entry = _currentDbContext.Entry(user);

            entry.Property("UserName").IsModified          = true;
            entry.Property("UserFirstName").IsModified     = true;
            entry.Property(e => e.UserLastName).IsModified = true;
            entry.Property(e => e.UserEmail).IsModified    = true;
            entry.Property(e => e.IsActive).IsModified     = true;
            entry.Property(e => e.DateUpdated).IsModified  = true;
            entry.Property(e => e.UpdatedBy).IsModified    = true;
            entry.Property(e => e.IsActive).IsModified     = true;

            //dont change password if password field is blank/null
            if (user.UserPassword != null)
            {
                // change user password into MD5 hash value
                user.UserPassword = GaneStaticAppExtensions.GetMd5(user.UserPassword);
                entry.Property(e => e.UserPassword).IsModified = true;
            }
            _currentDbContext.SaveChanges();
        }
        public ActionResult ProcessOrder(int?id)
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Order Order = OrderService.GetOrderById(id.Value);

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

            VerifyOrderAccountStatus(Order);

            var orderDto = AutoMapper.Mapper.Map <ReceivePOVM>(Order);

            orderDto.DeliveryNumber             = GaneStaticAppExtensions.GenerateDateRandomNo();
            orderDto.InventoryTransactionTypeId = (int)InventoryTransactionTypeEnum.SalesOrder;
            orderDto.AccountID   = Order.AccountID ?? 0;
            ViewBag.Consignments = new SelectList(OrderService.GetAllValidConsignmentTypes(CurrentTenantId), "ConsignmentTypeId", "ConsignmentType", Order.ConsignmentTypeId);

            //get http refferer

            string referrer = (Request.UrlReferrer != null) ? Request.UrlReferrer.ToString() : "/";

            // route to appropriate controller / action
            ViewBag.RController = "SalesOrders";

            if (referrer.Contains("PickList"))
            {
                ViewBag.RController = "PickList";
            }

            if (TempData["AutoCompleteError"] != null)
            {
                ViewBag.Warning = TempData["AutoCompleteError"].ToString();
            }

            var latestOrderProcess = Order.OrderProcess.OrderByDescending(m => m.DateCreated).FirstOrDefault();

            if (latestOrderProcess != null)
            {
                orderDto.ShipmentAddressLine1    = latestOrderProcess.ShipmentAddressLine1;
                orderDto.ShipmentAddressLine2    = latestOrderProcess.ShipmentAddressLine2;
                orderDto.ShipmentAddressLine3    = latestOrderProcess.ShipmentAddressLine3;
                orderDto.ShipmentAddressLine4    = latestOrderProcess.ShipmentAddressLine4;
                orderDto.ShipmentAddressPostcode = latestOrderProcess.ShipmentAddressPostcode;
            }
            else if (Order.Account != null)
            {
                if (Order.Account.AccountAddresses.Any())
                {
                    var address         = Order.Account.AccountAddresses.FirstOrDefault();
                    var shippingAddress = Order.Account.AccountAddresses.FirstOrDefault(m => m.AddTypeShipping == true);
                    if (shippingAddress != null)
                    {
                        address = shippingAddress;
                    }
                    if (address != null)
                    {
                        orderDto.ShipmentAddressLine1    = address.AddressLine1;
                        orderDto.ShipmentAddressLine2    = address.AddressLine2;
                        orderDto.ShipmentAddressLine3    = address.AddressLine3;
                        orderDto.ShipmentAddressLine4    = address.AddressLine4;
                        orderDto.ShipmentAddressPostcode = address.PostCode + ", " + address.GlobalCountry.CountryName;
                    }
                }
            }
            return(View(orderDto));
        }
Esempio n. 10
0
        public ActionResult BlindShipment(bool?delivery)
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }

            var accounts = AccountServices.GetAllValidAccounts(CurrentTenantId).Select(acnts => new
            {
                acnts.AccountID,
                acnts.AccountNameCode
            }).ToList();

            ViewBag.AccountID        = new SelectList(accounts, "AccountID", "AccountNameCode");
            ViewBag.AccountAddresses = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = "Select", Value = "0"
                }
            };
            ViewBag.ShowPriceInBlindShipment = caCurrent.CurrentWarehouse().ShowPriceInBlindShipment;
            ViewBag.ShowTaxInBlindShipment   = caCurrent.CurrentWarehouse().ShowTaxInBlindShipment;
            ViewBag.ShowQtyInBlindShipment   = caCurrent.CurrentWarehouse().ShowQtyInBlindShipment;
            ViewBag.ProductGroup             = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = "Select Group", Value = "0"
                }
            };
            ViewBag.ProductDepartment = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = "Select Department", Value = "0"
                }
            };
            ViewBag.Groups      = new SelectList(LookupServices.GetAllValidProductGroups(CurrentTenantId), "ProductGroupId", "ProductGroup");
            ViewBag.Departments = new SelectList(LookupServices.GetAllValidTenantDepartments(CurrentTenantId), "DepartmentId", "DepartmentName");
            var taxes = (from gtax in LookupServices.GetAllValidGlobalTaxes(CurrentTenant.CountryID)
                         select new
            {
                TaxId = gtax.TaxID,
                TaxName = gtax.TaxName + " - " + gtax.PercentageOfAmount + " %"
            }).ToList();

            ViewBag.GlobalTaxes = new SelectList(taxes, "TaxId", "TaxName");
            ViewBag.DeliveryNo  = GaneStaticAppExtensions.GenerateDateRandomNo();
            Session["bsList"]   = new List <BSDto>();
            if (delivery != null && delivery == true)
            {
                ViewBag.type     = (int)InventoryTransactionTypeEnum.SalesOrder;
                ViewBag.Title    = "Create Delivery";
                ViewBag.delivery = delivery;
                return(View());
            }

            ViewBag.Title = "Create Shipment";
            ViewBag.type  = (int)InventoryTransactionTypeEnum.PurchaseOrder;
            return(View());
        }