예제 #1
0
        public override dynamic SubmitJobViewModel(DiscoDataContext dbContext, Controller controller, Job Job, OrganisationAddress Address, User TechUser)
        {
            SubmitJobValidateEnvironment(dbContext, controller, TechUser, Job, null);

            var model = new ViewModels.NNOptionsViewModel()
            {
                NTPDevice = null,
                Issue     = 0
            };

            return(model);
        }
예제 #2
0
        public override Dictionary <string, string> SubmitJobParseProperties(DiscoDataContext dbContext, FormCollection form, Controller controller, Job Job, OrganisationAddress Address, User TechUser, string FaultDescription)
        {
            ViewModels.NNOptionsViewModel model = new ViewModels.NNOptionsViewModel();
            controller.TryUpdateModel(model);

            SubmitJobValidateEnvironment(dbContext, controller, TechUser, Job, model);

            return(new Dictionary <string, string>()
            {
                { "NTPDevice", model.NTPDevice.ToString() },
                { "Issue", model.Issue.ToString() }
            });
        }
예제 #3
0
        private void SubmitJobValidateEnvironment(DiscoDataContext dbContext, Controller controller, User TechUser, Job Job, ViewModels.NNOptionsViewModel OptionsModel)
        {
            // Validate TechUser Email Address
            if (OptionsModel == null || (OptionsModel.NTPDevice.HasValue && !OptionsModel.NTPDevice.Value))
            {
                // Non-NTP Device (or Unknown)
                // Check for Technicians Details
                if (string.IsNullOrEmpty(TechUser.EmailAddress))
                {
                    controller.ModelState.AddModelError(string.Empty, "NN Requires a Technician Email Address (Update your Email Address in Active Directory)");
                }
                if (string.IsNullOrEmpty(TechUser.PhoneNumber))
                {
                    controller.ModelState.AddModelError(string.Empty, "NN Requires a Technician Phone Number (Update your Telephone Number in Active Directory)");
                }
            }
            else
            {
                if (!NNSuspectedIssues.ContainsKey(OptionsModel.Issue))
                {
                    controller.ModelState.AddModelError("Issue", "Unknown Suspected Issue Id");
                }

                if (OptionsModel.NTPDevice.HasValue && OptionsModel.NTPDevice.Value)
                {
                    // NTP Device (Use Users Details)
                    if (string.IsNullOrEmpty(Job.User.EmailAddress))
                    {
                        controller.ModelState.AddModelError(string.Empty, "NN NTP Device requires the User's Email Address (Update the Email Address in Active Directory)");
                    }
                    if (string.IsNullOrEmpty(Job.User.PhoneNumber))
                    {
                        controller.ModelState.AddModelError(string.Empty, "NN NTP Device requires the User's Phone Number (Update the Phone Number in Active Directory)");
                    }
                }
                else
                {
                    // Non-NTP Device (or Unknown)
                    // Check for Technicians Details
                    if (string.IsNullOrEmpty(TechUser.EmailAddress))
                    {
                        controller.ModelState.AddModelError(string.Empty, "NN Requires a Technician Email Address (Update your Email Address in Active Directory)");
                    }
                    if (string.IsNullOrEmpty(TechUser.PhoneNumber))
                    {
                        controller.ModelState.AddModelError(string.Empty, "NN Requires a Technician Phone Number (Update your Telephone Number in Active Directory)");
                    }
                }
            }
        }
        public override Dictionary<string, string> SubmitJobParseProperties(DiscoDataContext dbContext, FormCollection form, Controller controller, Job Job, OrganisationAddress Address, User TechUser, string FaultDescription)
        {
            ViewModels.NNOptionsViewModel model = new ViewModels.NNOptionsViewModel();
            controller.TryUpdateModel(model);

            SubmitJobValidateEnvironment(dbContext, controller, TechUser, Job, model);

            return new Dictionary<string, string>() 
            {
                {"NTPDevice", model.NTPDevice.ToString()},
                {"Issue", model.Issue.ToString()}
            };
        }
        public override dynamic SubmitJobViewModel(DiscoDataContext dbContext, Controller controller, Job Job, OrganisationAddress Address, User TechUser)
        {
            SubmitJobValidateEnvironment(dbContext, controller, TechUser, Job, null);

            var model = new ViewModels.NNOptionsViewModel()
            {
                NTPDevice = null,
                Issue = 0
            };

            return model;
        }