コード例 #1
0
        public ActionResult Edit(int id)
        {
            var m = map.Map <Domain.Lookup, ViewModel.Lookup>(serv.Get(id));

            m.def = def;
            return(PartialView("Edit", m));
        }
コード例 #2
0
ファイル: ConfigController.cs プロジェクト: scotmoor/Machete
        public ActionResult Edit(int id)
        {
            var m = map.Map <Lookup, ViewModel.Lookup>(serv.Get(id));

            m.def = def;
            return(PartialView("~/Views/Lookup/Edit.cshtml", m));
        }
コード例 #3
0
        public async Task <OpportunityPublicResponse> Get(int id)
        {
            var opportunity = await _opportunityService.GetById(id, false);

            var agencies = _lookupService.Get("agency");
            var result   = _mapper.Map <OpportunityPublicResponse>(opportunity);

            return(result);
        }
コード例 #4
0
 private void getStatus(Guid?id = null)
 {
     try
     {
         List <LookupModel> model = new List <LookupModel>();
         model = lookupService.Get(LookUp.Status);
         model.Insert(0, new LookupModel()
         {
             Id = Guid.Empty, Name = "ALL"
         });
         ddlStatus.DataSource    = model;
         ddlStatus.DisplayMember = "Name";
         ddlStatus.ValueMember   = "Id";
     }
     catch (Exception ex)
     {
         Utility.ErrorLog.Logging("OPD History", ex.Message.ToString(), ex.StackTrace.ToString());
     }
 }
コード例 #5
0
 public Entity.BaseResponse <List <Entity.LookupItem> > Get(string type, string param = "")
 {
     Entity.BaseResponse <List <Entity.LookupItem> > response = new Entity.BaseResponse <List <Entity.LookupItem> >(true);
     try
     {
         response.Data = _service.Get(type, param);
     }
     catch (Exception ex)
     {
         return(new Entity.BaseResponse <List <Entity.LookupItem> >(false, ex.Message));
     }
     return(response);
 }
コード例 #6
0
 public CreateUserModelValidator(ILookupService lookupService)
 {
     RuleFor(u => u.Name).NotEmpty();
     RuleFor(u => u.Mobile).NotEmpty().MaximumLength(10);
     RuleFor(u => u.EmailAddress)
     .NotEmpty()
     .Matches(".+@.+\\.gov\\.au").WithMessage("{PropertyValue} must be a gov.au {PropertyName}");
     RuleFor(u => u.Agency)
     .NotEmpty()
     .Must(e => lookupService.Get("Agency", e) != null).WithMessage("{PropertyValue} is not a valid {PropertyName}.");
     RuleFor(u => u.Password)
     .NotEmpty()
     .MinimumLength(8);
 }
コード例 #7
0
 private void GetPerent()
 {
     try
     {
         List <LookupModel> model = service.Get(LookUp.Department);
         model.Insert(0, new LookupModel()
         {
             Id = Guid.Empty, Name = "--Select Department--"
         });
         ddlDepartment.DataSource    = model;
         ddlDepartment.DisplayMember = "Name";
         ddlDepartment.ValueMember   = "Id";
     }
     catch (Exception ex)
     {
         Utility.ErrorLog.Logging("Status Operations", ex.Message.ToString(), ex.StackTrace.ToString());
     }
 }
コード例 #8
0
        private void getDepartment()
        {
            try
            {
                List <LookupModel> model = lookupService.Get(LookUp.Department);
                //model.Insert(0, new LookupModel() { Id = Guid.Empty, Name = "--Select Department--" });
                ddlDepartment.DataSource    = model;
                ddlDepartment.DisplayMember = "Name";
                ddlDepartment.ValueMember   = "Id";

                if (model.Count <= 2)
                {
                    ddlDepartment.SelectedIndex = 1;
                }
            }
            catch (Exception ex)
            {
                Utility.ErrorLog.Logging("Patient Details", ex.Message.ToString(), ex.StackTrace.ToString());
            }
        }
コード例 #9
0
        public void getStatus(Guid?id = null)
        {
            try
            {
                List <LookupModel> model = new List <LookupModel>();
                model = lookupService.Get(LookUp.Status);
                if (id.HasValue)
                {
                    LookupModel m = model.FirstOrDefault(t => t.Id == id.Value);
                    if (m != null)
                    {
                        if (m.Name == OPD_STATUS.Pending.ToString())
                        {
                            model = model.Where(t => t.Name != OPD_STATUS.Complete.ToString()).ToList();
                            //isStatusHasInProgress = false;
                        }
                        if (m.Name == OPD_STATUS.Complete.ToString())
                        {
                            model = model.Where(t => t.Name != OPD_STATUS.Pending.ToString()).ToList();
                            //isStatusHasInProgress = false;
                        }
                    }
                }
                else
                {
                    //isStatusHasInProgress = true;
                }

                model.Insert(0, new LookupModel()
                {
                    Id = Guid.Empty, Name = "--Select Status--"
                });
                ddlStatus.DataSource    = model;
                ddlStatus.DisplayMember = "Name";
                ddlStatus.ValueMember   = "Id";
            }
            catch (Exception ex)
            {
                Utility.ErrorLog.Logging("OPD History", ex.Message.ToString(), ex.StackTrace.ToString());
            }
        }
コード例 #10
0
        public async Task <OpportunityResponseSaveResponse> Apply(OpportunityResponseApplyRequest model, IUser user)
        {
            var existing = await _opportunityResponseService.GetById(model.Id);

            if (existing == null)
            {
                throw new NotFoundException();
            }
            if (existing.UserId != user.Id)
            {
                throw new UnauthorizedAccessException();
            }
            if (existing.Opportunity.OpportunityUser.Any(ou => ou.UserId == user.Id))
            {
                throw new ValidationErrorException("You cannot apply for your own opportunity");
            }
            var toSave = _mapper.Map(model, existing);
            var saved  = await _opportunityResponseService.Update(toSave, user);

            if (!user.EmailVerified)
            {
                throw new ValidationErrorException("Email verification required. You can verify your email in your profile.");
            }
            toSave.SubmittedAt = DateTime.UtcNow;
            saved = await _opportunityResponseService.Update(toSave, user);

            var result = _mapper.Map <OpportunityResponseSaveResponse>(saved);
            var agency = _lookupService.Get("agency", existing.Opportunity.Agency);
            await _notifyService.SuccessfullyApplied(existing.Opportunity, agency, user);

            foreach (var ou in existing.Opportunity.OpportunityUser)
            {
                await _notifyService.ApplicationReceived(existing.Opportunity, agency, ou.User);
            }


            return(result);
        }
コード例 #11
0
        public IEnumerable <Lookup> Get([FromQuery] string type, [FromQuery] string searchText, [FromQuery] DataSourceRequest dataSourceRequest, [FromQuery] string args = null)
        {
            Dictionary <string, dynamic> argsDictionary = args == null ? null : JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(args);

            return(_LookupService.Get(type, searchText, dataSourceRequest, argsDictionary, null));
        }
コード例 #12
0
 public IEnumerable <LookupResponse> Get(string name) => _mapper.Map <List <LookupResponse> >(_lookupService.Get(name));