예제 #1
0
        public ActionResult SaveItem(PurchaseOrderLineItemViewModel input)
        {
            var vendor        = _repository.Find <Vendor>(input.RootId);
            var currentUser   = _sessionContext.GetCurrentUser();
            var purchaseOrder = input.ParentId > 0
                                    ? vendor.GetPurchaseOrderInProcess().FirstOrDefault(x => x.EntityId == input.ParentId)
                                    : new PurchaseOrder {
                Vendor = vendor, Status = TemporalStatus.Pending.ToString()
            };
            var baseProduct           = _repository.Find <BaseProduct>(input.PurchaseOrderLineItem.Product.EntityId);
            var newPo                 = purchaseOrder.EntityId == 0;
            var purchaseOrderLineItem = new PurchaseOrderLineItem
            {
                Product       = baseProduct,
                PurchaseOrder = purchaseOrder
            };

            mapItem(purchaseOrderLineItem, input.PurchaseOrderLineItem);
            purchaseOrder.AddLineItem(purchaseOrderLineItem);
            if (purchaseOrder.EntityId == 0)
            {
                vendor.AddPurchaseOrder(purchaseOrder);
            }
            var crudManager  = _saveEntityService.ProcessSave(purchaseOrder);
            var notification = crudManager.Finish();

            notification.Data = new { poId = purchaseOrder.EntityId };
            if (newPo)
            {
                notification.Redirect    = true;
                notification.RedirectUrl = UrlContext.GetUrlForAction <PurchaseOrderController>(x => x.AddEdit(null)) + "/" +
                                           vendor.EntityId + "?ParentId=" + purchaseOrder.EntityId;
            }
            return(Json(notification, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public LinkColumn <ENTITY> ForAction(string controllerName, string actionName)
        {
            var urlForAction = UrlContext.GetUrlForAction(controllerName, actionName);

            _actionUrl = urlForAction;
            return(this);
        }
예제 #3
0
        public ImageButtonColumn <ENTITY> ForAction <CONTROLLER>(Expression <Func <CONTROLLER, object> > expression) where CONTROLLER : Controller
        {
            var actionUrl = UrlContext.GetUrlForAction(expression);

            _actionUrl = actionUrl;
            return(this);
        }
예제 #4
0
        public LinkColumn <ENTITY> ForAction <CONTROLLER>(Expression <Func <CONTROLLER, object> > expression) where CONTROLLER : Controller
        {
            var urlForAction = UrlContext.GetUrlForAction(expression);

            _actionUrl = urlForAction;
            return(this);
        }
예제 #5
0
        //used for getting controller from a field value like "InstantiatingType"
        public LinkColumn <ENTITY> ForAction(Expression <Func <ENTITY, object> > expression, string actionName)
        {
            var controllerName = ReflectionHelper.GetAccessor(expression).FieldName + "Controller";
            var urlForAction   = UrlContext.GetUrlForAction(controllerName, actionName);

            _actionUrl = urlForAction;
            return(this);
        }
예제 #6
0
 public override void OnAuthorization(AuthorizationContext filterContext)
 {
     base.OnAuthorization(filterContext);
     if (filterContext.Result is HttpUnauthorizedResult)
     {
         filterContext.Result = new AjaxAwareRedirectResult(UrlContext.GetUrlForAction <LoginController>(x => x.Login(null)));
     }
 }
예제 #7
0
 public CalculatorViewModel GetViewModel()
 {
     return(new SandCalcViewModel
     {
         CalculatorDisplayName = WebLocalizationKeys.SAND.ToString(),
         CalculatorName = WebLocalizationKeys.SAND.ToString(),
         CalculateUrl = UrlContext.GetUrlForAction <CalculatorController>(x => x.Calculate(null)),
         SaveJSSuccssCallback = "kyt.calculator.controller.sandSuccess"
     });
 }
        public ActionResult PurchaseOrderList()
        {
            var           url   = UrlContext.GetUrlForAction <PurchaseOrderListController>(x => x.PurchaseOrders(null));
            ListViewModel model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <PurchaseOrderController>(x => x.AddEdit(null)),
                ListDefinition = _purchaseOrderListGrid.GetGridDefinition(url, WebLocalizationKeys.PURCHASE_ORDERS),
            };

            return(View(model));
        }
예제 #9
0
        public ActionResult Display(ViewModel input)
        {
            var document = _repository.Find <Document>(input.EntityId);
            var model    = new DocumentViewModel
            {
                Document   = document,
                AddEditUrl = UrlContext.GetUrlForAction <DocumentController>(x => x.AddUpdate(null)) + "/" + document.EntityId
            };

            return(View(model));
        }
예제 #10
0
        public ActionResult Display(ViewModel input)
        {
            var emailTemplate = _repository.Find <EmailJob>(input.EntityId);
            var model         = new EmailJobViewModel
            {
                EmailJob   = emailTemplate,
                AddEditUrl = UrlContext.GetUrlForAction <EmailJobController>(x => x.EmailJob(null)) + "/" + emailTemplate.EntityId
            };

            return(PartialView("EmailJobView", model));
        }
예제 #11
0
        public ActionResult Display(ViewModel input)
        {
            var seed  = _repository.Find <Seed>(input.EntityId);
            var model = new SeedViewModel
            {
                Seed       = seed,
                AddEditUrl = UrlContext.GetUrlForAction <SeedController>(x => x.AddEdit(null)) + "/" + seed.EntityId
            };

            return(PartialView("SeedView", model));
        }
예제 #12
0
        public ActionResult Display(ViewModel input)
        {
            var photo = _repository.Find <Photo>(input.EntityId);
            var model = new PhotoViewModel
            {
                Photo      = photo,
                AddEditUrl = UrlContext.GetUrlForAction <PhotoController>(x => x.AddUpdate(null)) + "/" + photo.EntityId
            };

            return(View(model));
        }
        public ActionResult Display(ViewModel input)
        {
            var fertilizer = _repository.Find <Fertilizer>(input.EntityId);
            var model      = new FertilizerViewModel
            {
                Fertilizer = fertilizer,
                AddEditUrl = UrlContext.GetUrlForAction <FertilizerController>(x => x.AddEdit(null)) + "/" + fertilizer.EntityId
            };

            return(PartialView("FertilizerView", model));
        }
예제 #14
0
        public ActionResult Display(ViewModel input)
        {
            var material = _repository.Find <Material>(input.EntityId);
            var model    = new MaterialViewModel
            {
                Material   = material,
                AddEditUrl = UrlContext.GetUrlForAction <MaterialController>(x => x.AddEdit(null)) + "/" + material.EntityId
            };

            return(PartialView("MaterialView", model));
        }
예제 #15
0
        public ActionResult Display(ViewModel input)
        {
            var employee = _repository.Find <Employee>(input.EntityId);
            var model    = new EmployeeViewModel
            {
                Employee   = employee,
                AddEditUrl = UrlContext.GetUrlForAction <EmployeeController>(x => x.AddEdit(null)) + "/" + employee.EntityId
            };

            return(PartialView("EmployeeView", model));
        }
        public ActionResult Display(ViewModel input)
        {
            var equipment = _repository.Find <Equipment>(input.EntityId);
            var model     = new EquipmentViewModel
            {
                Equipment  = equipment,
                AddEditUrl = UrlContext.GetUrlForAction <EquipmentController>(x => x.AddEdit(null)) + "/" + equipment.EntityId
            };

            return(PartialView("EquipmentView", model));
        }
예제 #17
0
        public ActionResult AddEdit(ViewModel input)
        {
            var field = input.EntityId > 0 ? _repository.Find <Field>(input.EntityId) : new Field();
            var model = new FieldViewModel
            {
                Field      = field,
                AddEditUrl = UrlContext.GetUrlForAction <FieldController>(x => x.AddEdit(null)) + "/" + field.EntityId,
            };

            return(PartialView("FieldAddUpdate", model));
        }
        public ActionResult Display(ViewModel input)
        {
            var vendorContact = _repository.Find <VendorContact>(input.EntityId);
            var model         = new VendorContactViewModel
            {
                VendorContact = vendorContact,
                AddEditUrl    = UrlContext.GetUrlForAction <VendorContactController>(x => x.AddEdit(null)) + "/" + vendorContact.EntityId
            };

            return(PartialView("VendorContactView", model));
        }
        public ActionResult Display(ViewModel input)
        {
            var purchaseOrderLineItem = _repository.Find <PurchaseOrderLineItem>(input.EntityId);
            var model = new PurchaseOrderLineItemViewModel
            {
                PurchaseOrderLineItem = purchaseOrderLineItem,
                AddEditUrl            = UrlContext.GetUrlForAction <PurchaseOrderLineItemController>(x => x.AddEdit(null)) + "/" + purchaseOrderLineItem.EntityId
            };

            return(PartialView("PurchaseOrderLineItemView", model));
        }
예제 #20
0
        public ActionResult TaskList()
        {
            var           url   = UrlContext.GetUrlForAction <TaskListController>(x => x.Tasks(null));
            ListViewModel model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <TaskController>(x => x.AddEdit(null)),
                ListDefinition = _taskListGrid.GetGridDefinition(url, WebLocalizationKeys.TASKS),
                CrudTitle      = WebLocalizationKeys.TASK_INFORMATION.ToString()
            };

            return(View(model));
        }
예제 #21
0
        public ActionResult EquipmentList()
        {
            var           url   = UrlContext.GetUrlForAction <EquipmentListController>(x => x.Equipments(null));
            ListViewModel model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <EquipmentController>(x => x.AddEdit(null)),
                ListDefinition = _equipmentListGrid.GetGridDefinition(url, WebLocalizationKeys.EQUIPMENT),
                CrudTitle      = WebLocalizationKeys.EQUIPMENT_INFORMATION.ToString()
            };

            return(View(model));
        }
예제 #22
0
        public ActionResult MaterialList()
        {
            var           url   = UrlContext.GetUrlForAction <MaterialListController>(x => x.Materials(null));
            ListViewModel model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <MaterialController>(x => x.AddEdit(null)),
                ListDefinition = _materialListGrid.GetGridDefinition(url, WebLocalizationKeys.MATERIALS),
                CrudTitle      = WebLocalizationKeys.MATERIAL_INFORMATION.ToString()
            };

            return(View(model));
        }
        public ActionResult FertilizerList()
        {
            var           url   = UrlContext.GetUrlForAction <FertilizerListController>(x => x.Fertilizers(null));
            ListViewModel model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <FertilizerController>(x => x.AddEdit(null)),
                ListDefinition = _fertilizerListGrid.GetGridDefinition(url, WebLocalizationKeys.FERTILIZERS),
                CrudTitle      = WebLocalizationKeys.FERTILIZER_INFORMATION.ToString()
            };

            return(View(model));
        }
예제 #24
0
        public ActionResult WeatherList(ListViewModel input)
        {
            var           url   = UrlContext.GetUrlForAction <WeatherListController>(x => x.Weathers(null));
            ListViewModel model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <WeatherController>(x => x.AddEdit(null)),
                ListDefinition = _weatherListGrid.GetGridDefinition(url, WebLocalizationKeys.WEATHER),
                CrudTitle      = WebLocalizationKeys.WEATHER_INFORMATION.ToString()
            };

            return(View(model));
        }
예제 #25
0
        public ActionResult EmployeeList()
        {
            var url   = UrlContext.GetUrlForAction <EmployeeListController>(x => x.Employees(null));
            var model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <EmployeeController>(x => x.AddEdit(null)),
                ListDefinition = _employeeListGrid.GetGridDefinition(url, WebLocalizationKeys.EMPLOYEES),
                CrudTitle      = WebLocalizationKeys.EMPLOYEE_INFORMATION.ToString()
            };

            return(View(model));
        }
        public ActionResult PhotoList(ListViewModel input)
        {
            var           url   = UrlContext.GetUrlForAction <PhotoListController>(x => x.Photos(null));
            ListViewModel model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <PhotoController>(x => x.AddUpdate(null)),
                ListDefinition = _photoListGrid.GetGridDefinition(url, WebLocalizationKeys.PHOTOS),
                CrudTitle      = WebLocalizationKeys.PHOTO_INFORMATION.ToString()
            };

            return(View(model));
        }
예제 #27
0
        public ActionResult VendorList(ListViewModel input)
        {
            var           url   = UrlContext.GetUrlForAction <VendorListController>(x => x.Vendors(null));
            ListViewModel model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <VendorController>(x => x.AddEdit(null)),
                ListDefinition = _vendorListGrid.GetGridDefinition(url, WebLocalizationKeys.VENDORS),
                CrudTitle      = WebLocalizationKeys.VENDOR_INFORMATION.ToString()
            };

            return(View(model));
        }
        public ActionResult CalculatorList()
        {
            var url = UrlContext.GetUrlForAction <CalculatorListController>(x => x.Calculators(null));
            CalculatorListViewModel model = new CalculatorListViewModel()
            {
                CreateATaskUrl = UrlContext.GetUrlForAction <TaskController>(x => x.AddEdit(null)) + "?From=Calculator",
                ListDefinition = _calculatorListGrid.GetGridDefinition(url, WebLocalizationKeys.CALCULATORS),
                CrudTitle      = WebLocalizationKeys.CALCULATOR.ToString()
            };

            return(View(model));
        }
        public ActionResult ClosePurchaseOrder(ViewModel input)
        {
            var purchaseOrder = _repository.Find <PurchaseOrder>(input.EntityId);

            purchaseOrder.Completed = true;
            purchaseOrder.GetLineItems().Where(x => !x.Completed).Each(x => x.Completed = true);
            var crudManager  = _saveEntityService.ProcessSave(purchaseOrder);
            var notification = crudManager.Finish();

            notification.RedirectUrl = UrlContext.GetUrlForAction <PurchaseOrderListController>(x => x.PurchaseOrderList());
            return(Json(notification, JsonRequestBehavior.AllowGet));
        }
예제 #30
0
        public ActionResult EmailJobList()
        {
            var           url   = UrlContext.GetUrlForAction <EmailJobListController>(x => x.EmailJobs(null));
            ListViewModel model = new ListViewModel()
            {
                AddEditUrl     = UrlContext.GetUrlForAction <EmailJobController>(x => x.EmailJob(null)),
                ListDefinition = _emailJobListGrid.GetGridDefinition(url, WebLocalizationKeys.EMAIL_TEMPLATES),
                CrudTitle      = WebLocalizationKeys.EMAIL_JOB_INFORMATION.ToString()
            };

            return(View(model));
        }