Пример #1
0
        public ActionResult ClientEntitlements(decimal id, decimal projectId = 0)
        {//TODO check to ajax
            CheckUserAuthorization();

            if (id < 0)
            {
                return(RedirectToAction("Index", "Projects"));
            }
            EntitlementsModel model = new EntitlementsModel();

            try
            {
                List <EEntitlement> entitlements = null;
                if (projectId > 0)
                {
                    entitlements      = EntitlementsProvider.GetEntitlements(id, projectId);
                    model.ProjectId   = projectId;
                    model.ProjectName = ProjectsProvider.GetProject(projectId).ProjectName;
                }
                else
                {
                    entitlements = EntitlementsProvider.GetEntitlementsForClient(id);
                }

                AddEntitlementsToModel(id, model, entitlements);
            }
            catch (Exception ex)
            {//TODO handle
            }
            return(View("Entitlements", model));
        }
Пример #2
0
        public ActionResult Edit(decimal id)
        {
            CheckUserAuthorization();
            var          project = ProjectsProvider.GetProject(id);
            ProjectModel model   = new ProjectModel(project);

            ViewBag.IsNewProject = false;
            return(View("CreateProject", model));
        }
Пример #3
0
        private static void AddEntitlementsToModel(decimal clientId, EntitlementsModel model, List <EEntitlement> entitlements)
        {
            List <ELicenseType>         licTypes  = EntitlementsProvider.GetLicenseTypes();
            List <EditEntitlementModel> entModels = new List <EditEntitlementModel>();

            foreach (EEntitlement dbEnt in entitlements)
            {
                var entModel = new EditEntitlementModel()
                {
                    LicenseTypeName = licTypes.FirstOrDefault(l => l.Id == dbEnt.LicenseTypeId).Name
                };
                entModels.Add(entModel.LoadEntitlement(dbEnt));
                entModel.Projectname = ProjectsProvider.GetProject(entModel.ProjectId).ProjectName;
            }
            model.Entitlemens        = entModels;
            model.ClientId           = clientId;
            model.ClientInternalName = ClientsProvider.GetClient(clientId).Name;
        }
Пример #4
0
        private void LoadProject(EditEntitlementModel model)
        {
            var project = ProjectsProvider.GetProject(model.ProjectId);

            model.Projectname = project.ProjectName;
        }