Exemple #1
0
        // GET: AppointmentResources/Create
        public ActionResult Create()
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }

            // get properties of current tenant
            var tenant = caCurrent.CurrentTenant();

            // get properties of user
            caUser user = caCurrent.CurrentUser();

            var wareh = _activityServices.GetAllPermittedWarehousesForUser(user.UserId, user.TenantId, user.SuperUser == true, false);

            var jTypes = LookupServices.GetAllJobTypes(CurrentTenantId).Select(m => new { m.JobTypeId, m.Name }).ToList();

            ViewBag.JobTypes        = new MultiSelectList(jTypes, "JobTypeId", "Name");
            ViewBag.RolesList1      = new SelectList(_rolesServices.GetAllRoles(tenant.TenantId), "Id", "RoleName");
            ViewBag.GroupsList1     = new SelectList(_groupsServices.GetAllGroups(tenant.TenantId), "Id", "GroupName");
            ViewBag.Countries       = new SelectList(LookupServices.GetAllGlobalCountries(), "CountryID", "CountryName");
            ViewBag.TenantLocations = new MultiSelectList(_tenantLocationsServices.GetAllTenantLocations(tenant.TenantId).Where(x => wareh.Any(a => a.WId == x.WarehouseId)), "WarehouseId", "WarehouseName");
            ViewBag.Users           = new SelectList(_userService.GetAllAuthUsers(CurrentTenantId), "UserId", "UserName");
            return(View());
        }
Exemple #2
0
        public ActionResult _Whouse()
        {
            // get properties of tenant
            caTenant tenant = caCurrent.CurrentTenant();

            var model = _tenantLocationServices.GetAllTenantLocations(tenant.TenantId);

            return(PartialView("__Whouse", model.ToList()));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">Employee Id</param>
        /// <returns></returns>
        public ActionResult Add()
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }


            try
            {
                ViewBag.StoresList = new SelectList(_storesServices.GetAllTenantLocations(CurrentTenantId), "WarehouseId", "WarehouseName");
                ViewBag.EmployeeId = new SelectList(_employeeServices.GetAllEmployeesByLocation(CurrentTenantId, CurrentWarehouseId), "ResourceId", "Name");

                List <SelectListItem> weeks = new List <SelectListItem>();
                for (int i = 1; i < 53; i++) //loop through weeks.
                {
                    weeks.AddRange(new[] {
                        new SelectListItem()
                        {
                            Text = "Week " + i, Value = i.ToString()
                        }
                    });
                }

                ViewData["WeekDaysList"] = new SelectList(weeks, "Value", "Text", GetWeekNumber());

                return(View("_CreateEdit", new ShiftsViewModel()
                {
                    StartTime = DateTime.Now,
                    EndTime = DateTime.Now,
                    ExpectedHours = TimeSpan.ParseExact("00:00", @"hh\:mm", System.Globalization.CultureInfo.InvariantCulture)
                }
                            ));
            }
            catch (Exception e)
            {
                //log exception
                var err = e.Message;

                return(View("_EmptyResult"));
            }
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "POID,WarehouseId,ExpectedDate,CancelDate,Notes,ProductId,Qty,Price,SupplierCode,OrderID")] OrderDetail podetail)
        {
            // get properties of tenant
            if (ModelState.IsValid)
            {
                OrderService.SaveOrderDetail(podetail, CurrentTenantId, CurrentUserId);
                return(RedirectToAction("Create", new { id = podetail.OrderID }));
            }

            var supplierid = OrderService.GetOrderById(podetail.OrderID).AccountID;

            ViewBag.Supplierid = supplierid;
            ViewBag.productId  = 0;
            var pr = OrderService.GetAllOrderDetailsForOrderAccount(supplierid.Value, podetail.OrderID, CurrentTenantId)
                     .Select(p => new
            {
                ProductID   = p.ProductId,
                Description = string.Format("{0} - {1}", p.ProductMaster.Name.Length >= 120 ? p.ProductMaster.Name.Substring(0, 120) : p.ProductMaster.Name, p.ProductMaster.SKUCode)
            }).ToList();

            var prod = pr.Distinct();

            ViewBag.ProductId = new SelectList(prod, "ProductID", "Description");

            ViewBag.WarehouseId = new SelectList(_tenantLocationServices.GetAllTenantLocations(CurrentTenantId), "WarehouseId", "WarehouseName");
            ViewBag.POID        = podetail.OrderID;
            ViewBag.PoDetail    = OrderService.GetAllValidOrderDetailsByOrderId(podetail.OrderID);
            ViewBag.Groups      = new SelectList(from p in LookupServices.GetAllValidProductGroups(CurrentTenantId)
                                                 where (p.TenentId == CurrentTenantId)
                                                 select new
            {
                ProductGroupId = p.ProductGroupId,
                ProductGroup   = p.ProductGroup
            }, "ProductGroupId", "ProductGroup");
            return(View(podetail));
        }