Ejemplo n.º 1
0
        public ActionResult CancleFactoryReport(string id)
        {
            int         factid      = int.Parse(id);
            VisitDetail visitDetail = db.VisitDetails.Where(v => v.FactoryId == factid && v.VisitDate == DateTime.Today).FirstOrDefault();

            return(View(visitDetail));
        }
Ejemplo n.º 2
0
        public override IEnumerable <VisitDetail> BuildVisitDetails(VisitDetail[] visitDetails, VisitOccurrence[] visitOccurrences, ObservationPeriod[] observationPeriods)
        {
            List <VisitDetail> details = new List <VisitDetail>();

            foreach (var visitOccurrence in visitOccurrences)
            {
                var visitDetail =
                    new VisitDetail(visitOccurrence)
                {
                    Id = visitOccurrence.Id,
                    DischargeToConceptId   = visitOccurrence.DischargeToConceptId,
                    DischargeToSourceValue = visitOccurrence.DischargeToSourceValue
                };

                details.Add(visitDetail);
            }

            foreach (var visitDetail in Clean(details, observationPeriods, true).Distinct())
            {
                //_visitDetails.Add(visitDetail.SourceRecordGuid, visitDetail);

                if (!visitDetail.EndDate.HasValue)
                {
                    visitDetail.EndDate = visitDetail.StartDate;
                }

                yield return(visitDetail);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new visit for the specified patient.
        /// </summary>
        /// <param name="patientRef">Patient for which the visit is created.</param>
        /// <param name="informationAuthority">Information authority to use for the visit number.</param>
        /// <param name="admitOffsetDays">A positive or negative number of days from today.</param>
        /// <param name="AdmissionType">Emergency or other types</param>
        /// <returns></returns>
        public static VisitSummary CreateVisit(PatientProfileSummary patientProfile, EnumValueInfo informationAuthority, int admitOffsetDays, EnumValueInfo AdmissionType)
        {
            InitReferenceDataCacheOnce();

            // Generate an active visit with randomize properties

            var          now = Platform.Time;
            const string activeAdmittedVisitStatus = "AA";
            var          visitDetail = new VisitDetail
            {
                Patient       = patientProfile,
                VisitNumber   = new CompositeIdentifierDetail(GenerateRandomIntegerString(10), informationAuthority),
                PatientClass  = ChooseRandom(_visitEditorFormData.PatientClassChoices),
                PatientType   = ChooseRandom(_visitEditorFormData.PatientTypeChoices),
                AdmissionType = AdmissionType ?? ChooseRandom(_visitEditorFormData.AdmissionTypeChoices),
                Status        = CollectionUtils.SelectFirst(_visitEditorFormData.VisitStatusChoices, enumValue => enumValue.Code == activeAdmittedVisitStatus),
                AdmitTime     = now + TimeSpan.FromDays(admitOffsetDays),
                Facility      = ChooseRandom(_visitEditorFormData.FacilityChoices)
            };

            VisitSummary visit = null;

            Platform.GetService(
                delegate(IVisitAdminService service)
            {
                var addVisitResponse = service.AddVisit(new AddVisitRequest(visitDetail));
                visit = addVisitResponse.Visit;
            });

            return(visit);
        }
Ejemplo n.º 4
0
            public async Task <VisitDetail> GetVisitInformation(string visitorId)
            {
                try
                {
                    // Create Request
                    var url      = $"{VISIT_ENDPOINT}?org={this.orgId}&visitor={visitorId}";
                    var response = await client.GetAsync(url);

                    response.EnsureSuccessStatusCode();
                    var     responseString = response.Content.ReadAsStringAsync();
                    JObject responseJson   = JObject.Parse(responseString.Result);

                    // Create Request
                    var visitDetail = new VisitDetail();
                    visitDetail.visitId   = responseJson["id"].ToString();
                    visitDetail.visitorId = responseJson["visitorId"].ToString();

                    // Print Visit information
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("Creating Visit");
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.WriteLine("User visit ID: " + visitDetail.visitId);
                    Console.WriteLine("User visitor ID: " + visitDetail.visitorId);
                    Console.WriteLine(" ");

                    this.visitDetail = visitDetail;
                    return(visitDetail);
                }
                catch (HttpRequestException e)
                {
                    Console.WriteLine("\nException Caught!");
                    Console.WriteLine("Message :{0} ", e.Message);
                    throw;
                }
            }
Ejemplo n.º 5
0
        //function for edit the already stored visit
        public Boolean EditVisit(Visitviewmodel model)
        {
            //for getting user id
            var userId = db.Users.Where(u => u.FullName == model.monitorname).Select(u => u.Id).FirstOrDefault();

            //for getting factory id
            var factoryid = db.Factory11.Where(f => f.Name == model.factroyname).Select(f => f.Id).FirstOrDefault();

            //getting the recored from db
            VisitDetail vd = db.VisitDetails.Where(v => v.Id == model.visitId).FirstOrDefault();

            //change the old values with new one
            vd.MonitorId = userId;
            vd.FactoryId = factoryid;
            vd.VisitDate = model.visitDate;

            //saving
            try
            {
                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        public VisitViewModel CreateGet()
        {
            context = new VisitorManagementContext();


            VisitViewModel visitViewModel = new VisitViewModel();
            VisitDetail    visitDetail    = new VisitDetail();

            var result = context.Arrangement.ToList();
            Common <Arrangement, ArrangementViewModel> common = new Common <Arrangement, ArrangementViewModel>();
            var resultViewModel = common.List_Source_Target(result);
            VisitArrangement visitArrangement = new VisitArrangement();

            visitArrangement.VisitDetailId  = visitDetail.VisitDetailId;
            visitViewModel.VisitArrangement = resultViewModel;

            var participants = context.VisitParticipant.ToList();
            Common <VisitParticipant, ParticipantViewModel> commonParticipants = new Common <VisitParticipant, ParticipantViewModel>();
            var participantViewModel = commonParticipants.List_Source_Target(participants);
            // visitViewModel.VisitParticipant = participantViewModel;


            var user = context.User.ToList();
            Common <User, UserViewModel> commonUser = new Common <User, UserViewModel>();

            visitViewModel.Users = commonUser.List_Source_Target(user);

            return(visitViewModel);
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> PutVisitDetail([FromRoute] int id, [FromBody] VisitDetail visitDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != visitDetail.QueueId)
            {
                return(BadRequest());
            }

            _context.Entry(visitDetail).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VisitDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            VisitDetail visitDetail = db.VisitDetails.Find(id);

            db.VisitDetails.Remove(visitDetail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 9
0
        public VisitViewModel EditGet(int id)
        {
            VisitViewModel visitViewModel = new VisitViewModel();


            visitViewModel.visitDetails = context.VisitDetail.FirstOrDefault(x => x.VisitDetailId == id);
            visitViewModel.visit        = context.Visitor.Find(visitViewModel.visitDetails.VisitorId);

            visitViewModel.PrimaryParticipant = context.VisitParticipant.Where(x => x.VisitDetailId == visitViewModel.visitDetails.VisitDetailId).FirstOrDefault().ParticipantId;
            var        secondaryParticipant    = context.VisitParticipant.Where(x => x.VisitDetailId == visitViewModel.visitDetails.VisitDetailId && x.IsPrimary == false).ToList();
            List <int> secondaryParticipantIds = new List <int>();

            foreach (var item in secondaryParticipant)
            {
                secondaryParticipantIds.Add(item.ParticipantId);
            }
            visitViewModel.SecondaryParticipant = secondaryParticipantIds;

            VisitDetail visitDetail     = new VisitDetail();
            var         SaveArrangments = context.VisitArrangement.Where(r => r.VisitDetailId == visitViewModel.visitDetails.VisitDetailId).ToList();
            var         result          = context.Arrangement.ToList();
            Common <Arrangement, ArrangementViewModel> common = new Common <Arrangement, ArrangementViewModel>();
            var resultViewModel = common.List_Source_Target(result);
            VisitArrangement visitArrangement = new VisitArrangement();

            visitArrangement.VisitDetailId  = visitDetail.VisitDetailId;
            visitViewModel.VisitArrangement = resultViewModel;



            foreach (ArrangementViewModel arrangement in visitViewModel.VisitArrangement)
            {
                var _visitarrangment = SaveArrangments.Where(r => r.ArrangementId == arrangement.ArrangementId).FirstOrDefault();
                if (_visitarrangment != null)
                {
                    arrangement.IsSelected        = true;
                    arrangement.ArrangementId     = _visitarrangment.ArrangementId;
                    arrangement.DelegateContactID = _visitarrangment.DelegateContactId;
                    arrangement.Description       = _visitarrangment.Description;
                }
            }


            var participants = context.VisitParticipant.ToList();
            Common <VisitParticipant, ParticipantViewModel> commonParticipants = new Common <VisitParticipant, ParticipantViewModel>();
            var participantViewModel          = commonParticipants.List_Source_Target(participants);
            VisitParticipant visitParticipant = new VisitParticipant();

            visitParticipant.VisitDetailId = visitDetail.VisitDetailId;


            var user = context.User.ToList();
            Common <User, UserViewModel> commonUser = new Common <User, UserViewModel>();

            visitViewModel.Users = commonUser.List_Source_Target(user);
            return(visitViewModel);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Создать детали визита
        /// </summary>
        /// <param name="goal">Цель визита</param>
        /// <param name="country">Страна визита</param>
        /// <param name="visitingPoints">Пункты посещения</param>
        /// <param name="period">Период пребывания</param>
        /// <param name="arrivalDate">Дата прибытия</param>
        /// <param name="departureDate">Дата отъезда</param>
        /// <param name="visaType">Тип визы</param>
        /// <param name="visaCity">Город получения визы</param>
        /// <param name="visaCountry">Страна получения визы</param>
        /// <param name="visaMultiplicity">Кратность визы</param>
        /// <returns>Идентификатор деталей визита</returns>
        public VisitDetail Create()
        {
            var createdVisitDetail = new VisitDetail();

            // TODO: унести в репозиторий
            _context.Set <VisitDetail>().Add(createdVisitDetail);

            return(createdVisitDetail);
        }
 public ActionResult Employee(VisitDetail obj)
 {
     if (obj != null)
     {
         return(View(obj));
     }
     else
     {
         return(View());
     }
 }
Ejemplo n.º 12
0
 public ActionResult Edit([Bind(Include = "visitDetailId,price,description,petId,visitId")] VisitDetail visitDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(visitDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.visitId = new SelectList(db.Visit, "visitId", "description", visitDetail.visitId);
     return(View(visitDetail));
 }
Ejemplo n.º 13
0
        public ActionResult UpdateVisit(VisitDetail visit)
        {
            ObjectParameter statusCode    = new ObjectParameter("StatusCode", typeof(int));
            ObjectParameter statusMessage = new ObjectParameter("StatusMessage", typeof(string));

            var result = db.AddUpdateVisit(visit.Id, visit.FactoryId, visit.MonitorId, visit.VisitDate, statusCode, statusMessage);

            return(RedirectToAction("Home", "Home", new
            {
                id = 1
            }));
        }
 public ActionResult Edit([Bind(Include = "visitDetailID,price,visitID,doctorID")] VisitDetail visitDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(visitDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.doctorID = new SelectList(db.Doctors, "doctorID", "firstName", visitDetail.doctorID);
     ViewBag.visitID  = new SelectList(db.Visits, "visitID", "description", visitDetail.visitID);
     return(View(visitDetail));
 }
Ejemplo n.º 15
0
        public async Task <IActionResult> PostVisitDetail([FromBody] VisitDetail visitDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.VisitDetails.Add(visitDetail);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetVisitDetail", new { id = visitDetail.QueueId }, visitDetail));
        }
Ejemplo n.º 16
0
        public void UpdateVisit(Visit visit, VisitDetail detail, IPersistenceContext context)
        {
            visit.Patient        = context.Load <Patient>(detail.Patient.PatientRef, EntityLoadFlags.Proxy);
            visit.VisitNumber.Id = detail.VisitNumber.Id;
            visit.VisitNumber.AssigningAuthority = EnumUtils.GetEnumValue <InformationAuthorityEnum>(detail.VisitNumber.AssigningAuthority, context);

            visit.AdmissionType = EnumUtils.GetEnumValue <AdmissionTypeEnum>(detail.AdmissionType, context);
            visit.PatientClass  = EnumUtils.GetEnumValue <PatientClassEnum>(detail.PatientClass, context);
            visit.PatientType   = EnumUtils.GetEnumValue <PatientTypeEnum>(detail.PatientType, context);
            visit.Status        = EnumUtils.GetEnumValue <VisitStatus>(detail.Status);

            visit.AdmitTime            = detail.AdmitTime;
            visit.DischargeTime        = detail.DischargeTime;
            visit.DischargeDisposition = detail.DischargeDisposition;
            visit.VipIndicator         = detail.VipIndicator;

            visit.Facility = detail.Facility == null ? null :
                             context.Load <Facility>(detail.Facility.FacilityRef, EntityLoadFlags.Proxy);
            visit.CurrentLocation = detail.CurrentLocation == null ? null :
                                    context.Load <Location>(detail.CurrentLocation.LocationRef, EntityLoadFlags.Proxy);
            visit.CurrentRoom = detail.CurrentRoom;
            visit.CurrentBed  = detail.CurrentBed;

            visit.Locations.Clear();
            foreach (var vlDetail in detail.Locations)
            {
                visit.Locations.Add(new VisitLocation(
                                        context.Load <Location>(vlDetail.Location.LocationRef, EntityLoadFlags.Proxy),
                                        vlDetail.Room,
                                        vlDetail.Bed,
                                        EnumUtils.GetEnumValue <VisitLocationRole>(vlDetail.Role),
                                        vlDetail.StartTime,
                                        vlDetail.EndTime));
            }

            visit.Practitioners.Clear();
            foreach (var vpDetail in detail.Practitioners)
            {
                visit.Practitioners.Add(new VisitPractitioner(
                                            context.Load <ExternalPractitioner>(vpDetail.Practitioner.PractitionerRef, EntityLoadFlags.Proxy),
                                            EnumUtils.GetEnumValue <VisitPractitionerRole>(vpDetail.Role),
                                            vpDetail.StartTime,
                                            vpDetail.EndTime));
            }

            visit.AmbulatoryStatuses.Clear();
            foreach (var ambulatoryStatus in detail.AmbulatoryStatuses)
            {
                visit.AmbulatoryStatuses.Add(EnumUtils.GetEnumValue <AmbulatoryStatusEnum>(ambulatoryStatus, context));
            }

            ExtendedPropertyUtils.Update(visit.ExtendedProperties, detail.ExtendedProperties);
        }
 public ActionResult Edit([Bind(Include = "visitID,visitDate,price,petID,vetID")] VisitDetail visitDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(visitDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.petID = new SelectList(db.Pets, "petID", "petName", visitDetail.petID);
     ViewBag.vetID = new SelectList(db.Vets, "vetID", "fullName", visitDetail.vetID);
     return(View(visitDetail));
 }
Ejemplo n.º 18
0
 public ActionResult Edit([Bind(Include = "visitDetailId,visitPrice,petId,treatmentId")] VisitDetail visitDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(visitDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.petId       = new SelectList(db.Pets, "petId", "petBreed", visitDetail.petId);
     ViewBag.treatmentId = new SelectList(db.Treatments, "treatmentId", "treatmentDescription", visitDetail.treatmentId);
     return(View(visitDetail));
 }
Ejemplo n.º 19
0
        public VisitDetail CreateVisitDetail(Guid visitId)
        {
            var newVisitDetail = new VisitDetail
            {
                VisitDetail_ID = _visitsDetails.Count + 1,
                Treatment_ID   = _treatments[_rnd.Next(0, _treatments.Count)].Treatment_ID
            };

            newVisitDetail.TotalCost += _treatments[newVisitDetail.Treatment_ID - 1].Price;
            newVisitDetail.Visit_ID   = visitId;

            return(newVisitDetail);
        }
Ejemplo n.º 20
0
        // GET: VisitDetails/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VisitDetail visitDetail = db.VisitDetails.Find(id);

            if (visitDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(visitDetail));
        }
Ejemplo n.º 21
0
        public ActionResult CancleFactoryReport(VisitDetail visitDetail)
        {
            VisitService visitService = new VisitService();
            var          result       = visitService.CancleVisit(visitDetail);

            if (result == true)
            {
                return(RedirectToAction("Home", "Home", new { id = 1 }));
            }
            else
            {
                return(RedirectToAction("ConcreteFactoryReports", "ConcreteFactoryReports", new { id = visitDetail.FactoryId }));
            }
        }
Ejemplo n.º 22
0
        // GET: VisitDetails/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VisitDetail visitDetail = db.VisitDetails.Find(id);

            if (visitDetail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.visitId = new SelectList(db.Visit, "visitId", "description", visitDetail.visitId);
            return(View(visitDetail));
        }
Ejemplo n.º 23
0
        public override IEnumerable <VisitDetail> BuildVisitDetails(VisitDetail[] visitDetails,
                                                                    VisitOccurrence[] visitOccurrences, ObservationPeriod[] observationPeriods)
        {
            foreach (var visitOccurrence in visitOccurrences)
            {
                var visitDetail =
                    new VisitDetail(visitOccurrence)
                {
                    Id         = visitOccurrence.Id,
                    CareSiteId = visitOccurrence.CareSiteId,
                };

                yield return(visitDetail);
            }
        }
        // GET: VisitDetails/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VisitDetail visitDetail = db.VisitDetails.Find(id);

            if (visitDetail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.doctorID = new SelectList(db.Doctors, "doctorID", "firstName", visitDetail.doctorID);
            ViewBag.visitID  = new SelectList(db.Visits, "visitID", "description", visitDetail.visitID);
            return(View(visitDetail));
        }
Ejemplo n.º 25
0
        //查看
        private void hlbVisitedView_Click(object sender, RoutedEventArgs e)
        {
            dynamic visit = this.dgVisited.SelectedItem as dynamic;

            if (visit != null)
            {
                VisitDetail content = new VisitDetail();
                content.Width      = 800d;
                content.Height     = 440d;
                content.VisitSysNo = visit.SysNo;
                IDialog dialog = this.Window.ShowDialog(ResCustomerVisit.Dialog_Title_ViewVisitDetail, content, (obj, args) =>
                {
                });
                content.Dialog = dialog;
            }
        }
Ejemplo n.º 26
0
        // GET: VisitDetails/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VisitDetail visitDetail = db.VisitDetails.Find(id);

            if (visitDetail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.petId       = new SelectList(db.Pets, "petId", "petBreed", visitDetail.petId);
            ViewBag.treatmentId = new SelectList(db.Treatments, "treatmentId", "treatmentDescription", visitDetail.treatmentId);
            return(View(visitDetail));
        }
        // GET: VisitDetails/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VisitDetail visitDetail = db.VisitDetails.Find(id);

            if (visitDetail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.petID = new SelectList(db.Pets, "petID", "petName", visitDetail.petID);
            ViewBag.vetID = new SelectList(db.Vets, "vetID", "fullName", visitDetail.vetID);
            return(View(visitDetail));
        }
Ejemplo n.º 28
0
 public static VisitDetailResult ConvertToResult(VisitDetail visitDetail)
 {
     return(new VisitDetailResult
     {
         Id = visitDetail.Id,
         Goal = visitDetail.Goal,
         Country = visitDetail.Country,
         VisaType = visitDetail.VisaType,
         VisaCity = visitDetail.VisaCity,
         VisaCountry = visitDetail.VisaCountry,
         VisitingPoints = visitDetail.VisitingPoints,
         VisaMultiplicity = visitDetail.VisaMultiplicity,
         PeriodInDays = visitDetail.PeriodDays,
         ArrivalDate = visitDetail.ArrivalDate,
         DepartureDate = visitDetail.DepartureDate,
     });
 }
Ejemplo n.º 29
0
        public VisitDetail CreateVisitDetail(Visit visit, IPersistenceContext context)
        {
            var patientProfileAssembler = new PatientProfileAssembler();
            var detail = new VisitDetail
            {
                VisitRef             = visit.GetRef(),
                Patient              = patientProfileAssembler.CreatePatientProfileSummary(visit.PatientProfile, context),
                VisitNumber          = CreateVisitNumberDetail(visit.VisitNumber),
                AdmissionType        = EnumUtils.GetEnumValueInfo(visit.AdmissionType),
                PatientClass         = EnumUtils.GetEnumValueInfo(visit.PatientClass),
                PatientType          = EnumUtils.GetEnumValueInfo(visit.PatientType),
                Status               = EnumUtils.GetEnumValueInfo(visit.Status, context),
                AdmitTime            = visit.AdmitTime,
                DischargeTime        = visit.DischargeTime,
                DischargeDisposition = visit.DischargeDisposition,
                Facility             = new FacilityAssembler().CreateFacilitySummary(visit.Facility),
                CurrentLocation      = visit.CurrentLocation == null ? null : new LocationAssembler().CreateLocationSummary(visit.CurrentLocation),
                CurrentRoom          = visit.CurrentRoom,
                CurrentBed           = visit.CurrentBed,
                Locations            = new List <VisitLocationDetail>(),
                PreadmitNumber       = visit.PreadmitNumber,
                VipIndicator         = visit.VipIndicator,
                ExtendedProperties   = ExtendedPropertyUtils.Copy(visit.ExtendedProperties)
            };

            foreach (var vl in visit.Locations)
            {
                detail.Locations.Add(CreateVisitLocationDetail(vl, context));
            }

            detail.Practitioners = new List <VisitPractitionerDetail>();
            foreach (var vp in visit.Practitioners)
            {
                detail.Practitioners.Add(CreateVisitPractitionerDetail(vp, context));
            }

            detail.AmbulatoryStatuses = new List <EnumValueInfo>();
            foreach (var ambulatoryStatus in visit.AmbulatoryStatuses)
            {
                detail.AmbulatoryStatuses.Add(EnumUtils.GetEnumValueInfo(ambulatoryStatus));
            }

            return(detail);
        }
Ejemplo n.º 30
0
 //function for create new  visit
 public Boolean CreateVisits(VisitDetail model)
 {
     db.VisitDetails.Add(new VisitDetail
     {
         FactoryId = model.FactoryId,
         MonitorId = model.MonitorId,
         Status    = model.Status,
         VisitDate = model.VisitDate
     });
     try
     {
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Ejemplo n.º 31
0
        public async Task<IHttpActionResult> SetVisit([FromBody]ParmSetVisit parm)
        {
            ResultInfo r = new ResultInfo();

            try
            {
                #region working a
                db0 = getDB0();
                var master = db0.Visit.Where(x => x.i_InsertUserID == this.UserId && x.visit_date == parm.visit_date).FirstOrDefault();
                if (master == null)
                {
                    master = new Visit()
                    {
                        visit_id = GetNewId(),
                        users_id = this.UserId,
                        visit_date = parm.visit_date,
                        i_InsertUserID = this.UserId,
                        i_InsertDateTime = DateTime.Now,
                        i_InsertDeptID = this.departmentId,
                        i_Lang = "zh-TW"
                    };
                    db0.Visit.Add(master);
                }

                var detail = db0.VisitDetail.Where(x => x.visit_id == master.visit_id && x.customer_id == parm.customer_id).FirstOrDefault();

                if (detail == null)
                {
                    detail = new VisitDetail()
                    {
                        visit_detail_id = GetNewId(),
                        visit_id = master.visit_id,
                        users_id = master.users_id,
                        state = (byte)VisitDetailState.wait,
                        customer_id = parm.customer_id,
                        i_InsertUserID = this.UserId,
                        i_InsertDateTime = DateTime.Now,
                        i_InsertDeptID = this.departmentId,
                        i_Lang = "zh-TW"
                    };
                    db0.VisitDetail.Add(detail);
                }

                await db0.SaveChangesAsync();

                r.result = true;
                r.id = master.visit_id;
                return Ok(r);
                #endregion
            }
            catch (Exception ex)
            {
                r.result = false;
                r.message = ex.Message;
                return Ok(r);
            }
            finally
            {
                db0.Dispose();
            }
        }
Ejemplo n.º 32
0
 public UpdateVisitRequest(EntityRef visitRef, VisitDetail detail)
 {
     this.VisitRef = visitRef;
     this.VisitDetail = detail;
 }
 public LoadVisitForEditResponse(EntityRef visitRef, VisitDetail visitDetail)
 {
     this.VisitRef = visitRef;
     this.VisitDetail = visitDetail;
 }
Ejemplo n.º 34
0
        public GetVisitDetailResponse(VisitDetail visitDetail)
        {
			this.Visit = visitDetail;
        }
Ejemplo n.º 35
0
 public AddVisitRequest(VisitDetail visitDetail)
 {
     this.VisitDetail = visitDetail;
 }