Exemplo n.º 1
0
        public ActionResult Create()
        {
            var model = new ServiceVm();

            model.PatientListItems = iServiceBL.GetAllPatientNameId();
            return(View(model));
        }
        // GET: Service/Create
        public ActionResult Create()
        {
            ServiceVm vm = new ServiceVm();

            vm.ServiceTypes = GetAllServiceTypes();
            return(View(vm));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取所有的服务
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <Tuple <long, List <Service> > > GetServiveListAsync(ServiceVm model)
        {
            if (model == null)
            {
                return(new Tuple <long, List <Service> >(0, new List <Service>()));
            }

            var totalQuery = this.Entity;

            if (!string.IsNullOrEmpty(model.ServiceName))
            {
                totalQuery = totalQuery.Where(r => r.ServiceName.Equals(model.ServiceName));
            }

            var total = totalQuery.CountAsync();

            var query = this.Entity;

            if (!string.IsNullOrEmpty(model.ServiceName))
            {
                query = query.Where(r => r.ServiceName.Equals(model.ServiceName));
            }

            var list = await query.DynamicOrderBy(string.IsNullOrEmpty(model.OrderBy)? "DataChangeLastTime" : model.OrderBy,
                                                  model.OrderSequence)
                       .Skip((model.PageIndex - 1) * model.PageSize)
                       .Take(model.PageSize)
                       .ToListAsync();

            return(new Tuple <long, List <Service> >(await total, list));
        }
Exemplo n.º 4
0
        public void Create(ServiceVm vm)
        {
            Service service = new Service();

            service.Name          = vm.Name;
            service.CostPerHour   = vm.CostPerHour;
            service.ServiceTypeId = vm.ServiceTypeId;
            ServiceDb.Create(service);
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(ServiceVm serviceVm)
        {
            if (string.IsNullOrEmpty(Convert.ToString(serviceVm.ServiceId)))
            {
                return(View());
            }
            var model = await iServiceBL.UpdateServiceAsync(serviceVm);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
        public void Edit(ServiceVm vm)
        {
            Service service = new Service();

            service.Id            = vm.Id;
            service.Name          = vm.Name;
            service.CostPerHour   = vm.CostPerHour;
            service.ServiceTypeId = vm.ServiceTypeId;
            ServiceDb.Edit(service);
        }
        public ActionResult Edit(ServiceVm vm)
        {
            try {
                var model = new Service();
                model.Edit(vm);

                return(RedirectToAction("Index"));
            } catch (Exception ex) {
                return(View("Error"));
            }
        }
Exemplo n.º 8
0
 public bool DeleteService(ServiceVm service)
 {
     if (service != null)
     {
         //get the service using the id
         Service serviceMd = _session.QueryOver <Service>().Where(x => x.Id == service.Id).SingleOrDefault();
         //update the service
         serviceMd.IsDeleted = true;
         _session.Transact(session => session.Update(serviceMd));
     }
     return(true);
 }
Exemplo n.º 9
0
        /// <summary>
        /// 获取活动列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <JsonResult> GetServiveList([FromUri] ServiceVm model)
        {
            var result            = new SearchResult <List <Service> >();
            ServiceRepository rep = new ServiceRepository();
            var respositoryResult = await rep.GetServiveListAsync(model);

            result.Status = ResultConfig.Ok;
            result.Info   = ResultConfig.SuccessfulMessage;
            result.Rows   = respositoryResult.Item2;
            result.Total  = respositoryResult.Item1;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 10
0
        // GET: Service/Edit/5
        public ActionResult Edit(int id)
        {
            var       row = ServiceDb.GetServiceById(id).Rows[0];
            ServiceVm vm  = new ServiceVm();

            vm.Id            = id;
            vm.Name          = row["Name"].ToString();
            vm.CostPerHour   = (decimal)row["CostPerHour"];
            vm.ServiceTypeId = (int)row["ServiceTypeId"];
            vm.ServiceTypes  = GetAllServiceTypes();
            return(View(vm));
        }
Exemplo n.º 11
0
        public ActionResult Create(ServiceVm servicevm)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            if (string.IsNullOrEmpty(servicevm.Advice))
            {
                return(View());
            }
            iServiceBL.AddService(servicevm);
            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 12
0
        public ActionResult Create(ServiceVm vm)
        {
            try {
                if (!ModelState.IsValid)
                {
                    return(View());
                }

                var model = new Service();
                model.Create(vm);

                return(RedirectToAction("Index"));
            } catch (Exception ex) {
                return(View("Error"));
            }
        }
Exemplo n.º 13
0
        public bool AddnewService(ServiceVm service)
        {
            //Add date Added

            Service serviceMd = new Service
            {
                Name        = service.Name,
                Code        = service.Code,
                Description = service.Description,
                Status      = service.Status,
                //Dateadded = DateTime.Now,
                CreatedBy = CurrentRequestData.CurrentUser.Id,
            };

            _session.Transact(session => session.Save(serviceMd));
            return(true);
        }
Exemplo n.º 14
0
 public ActionResult Delete(ServiceVm service)
 {
     if (service.Id > 0)
     {
         bool response = _serviceService.DeleteService(service);
         if (response)
         {
             _pageMessageSvc.SetSuccessMessage(string.Format("Service [{0}] was deleted successfully.", service.Name.ToUpper()));
         }
         else
         {
             _pageMessageSvc.SetErrormessage(string.Format("There was an error deleting service [{0}] ",
                                                           service.Name.ToUpper()));
         }
     }
     return(_uniquePageService.RedirectTo <ServicesPage>());
 }
Exemplo n.º 15
0
 public void AddService(ServiceVm servicevm)
 {
     if (!string.IsNullOrEmpty(servicevm.Advice))
     {
         iRepository.HealthCareDbContext.Services.Add(
             new Service()
         {
             Comments      = servicevm.Comments,
             Advice        = servicevm.Advice,
             Medication    = servicevm.Medication,
             PatientId     = servicevm.PatientId,
             ServiceCharge = servicevm.ServiceCharge,
             ServiceTime   = DateTime.Now,
             Symtoms       = servicevm.Symtoms
         });
         iRepository.HealthCareDbContext.SaveChanges();
     }
 }
Exemplo n.º 16
0
        public bool UpdateService(ServiceVm service)
        {
            Service serviceMd = _session.QueryOver <Service>().Where(x => x.Id == service.Id).SingleOrDefault();

            if (serviceMd != null)
            {
                serviceMd.Name        = service.Name;
                serviceMd.Code        = service.Code;
                serviceMd.Description = service.Description;
                serviceMd.Status      = service.Status;

                _session.Transact(session => session.Update(serviceMd));
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 17
0
        public async Task <bool> UpdateServiceAsync(ServiceVm servicevm)
        {
            var service = iRepository.HealthCareDbContext.Services.FirstOrDefault(x => x.ServiceId == servicevm.ServiceId);

            if (service != null)
            {
                service.Comments      = servicevm.Comments;
                service.Advice        = servicevm.Advice;
                service.Medication    = servicevm.Medication;
                service.PatientId     = servicevm.PatientId;
                service.ServiceCharge = servicevm.ServiceCharge;
                service.ServiceTime   = DateTime.Now;
                service.Symtoms       = servicevm.Symtoms;
                await iRepository.HealthCareDbContext.SaveChangesAsync();

                return(true);
            }
            return(false);
        }
Exemplo n.º 18
0
        public async Task <ServiceVm> GetServiceByID(Guid serviceID)
        {
            var services = await iRepository.HealthCareDbContext.Services.FirstOrDefaultAsync(x => x.ServiceId == serviceID);

            var model = new ServiceVm()
            {
                ServiceId       = services.ServiceId,
                Advice          = services.Advice,
                Comments        = services.Comments,
                FullName        = services.Patient.FirstName + " " + services.Patient.LastName,
                Medication      = services.Medication,
                PatientId       = services.PatientId,
                ServiceTime     = services.ServiceTime,
                Symtoms         = services.Symtoms,
                ServiceCharge   = services.ServiceCharge,
                PatientListItem = new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem()
                {
                    Text = services.Patient.FirstName + " " + services.Patient.LastName + "(" + services.PatientId + ")", Value = services.PatientId.ToString()
                }
            };

            return(model);
        }
Exemplo n.º 19
0
        public ActionResult Add(ServiceVm services)
        {
            //set the created user
            bool response = _serviceService.AddnewService(services);

            if (response)
            {
                //successfule
                //Set the success message for user to see
                _pageMessageSvc.SetSuccessMessage(string.Format("Service [{0}] was added successfully.", services.Name.ToUpper()));
                //Session["PageSuccessMessage"] = string.Format("Service [{0}] was added successfully.", services.Name.ToUpper());
            }
            else
            {
                //there was an error
                //Set the Error message for user to see
                //Session["PageErrorMessage"] = string.Format("There was an error adding service [{0}] ", services.Name.ToUpper());
                _pageMessageSvc.SetErrormessage(string.Format("There was an error adding service [{0}] ",
                                                              services.Name.ToUpper()));
            }

            return(_uniquePageService.RedirectTo <ServicesPage>());
        }
Exemplo n.º 20
0
 public ActionResult Edit(ServiceVm service)
 {
     _serviceService.UpdateService(service);
     return(_uniquePageService.RedirectTo <ServicesPage>());
 }
 public static Service ToEntity(this ServiceVm viewModel)
 => ViewModelMapper.ConfigMapper.Map <ServiceVm, Service>(viewModel);
Exemplo n.º 22
0
        public ActionResult Delete(int id)
        {
            ServiceVm item = _serviceService.GetService(id);

            return(PartialView("DeleteService", item));
        }
Exemplo n.º 23
0
        public ActionResult Edit(int id)
        {
            ServiceVm service = _serviceService.GetService(id);

            return(PartialView("EditService", service));
        }