/// <summary>
        /// This function calculate the Total Service of Employee from its appointment
        /// date to the present date.
        /// </summary>
        /// <returns>Return the string of years, months and days</returns>
        public string GetTotalServices()
        {
            var dt = DateTime.Now;
            //Calculate the years between the dates
            var years    = new DateTime(DateTime.Now.Subtract(AppointmentDate).Ticks).Year - 1;
            var pastYear = AppointmentDate.AddYears(years);
            //Calculate the months between the dates
            var months = 0;

            for (int i = 1; i <= 12; i++)
            {
                if (pastYear.AddMonths(i) == dt)
                {
                    months = i;
                }
                else if (pastYear.AddMonths(i) >= dt)
                {
                    months = i - 1;
                    break;
                }
            }
            //Calculate the days between the dates
            var days = dt.Subtract(pastYear.AddMonths(months)).Days;

            string date = string.Format("{0} years {1} months {2} days", years, months, days);

            return(date);
        }
        public bool IsOverlapping(
            AppointmentDate appointmentDate,
            Client client,
            Doctor doctor,
            OfficeRoom officeRoom)
        {
            var occupiedRoom = officeRoom.Id == this.OfficeRoom.Id &&
                               !this.OfficeRoom.IsAvailable;

            var dateIsNotFree = (appointmentDate.StartDate > this.AppointmentDate.EndDate &&
                                 appointmentDate.EndDate > this.AppointmentDate.EndDate) ||
                                appointmentDate.EndDate < this.AppointmentDate.StartDate &&
                                appointmentDate.StartDate < this.AppointmentDate.StartDate;

            var busyDoctor = doctor.UserId == this.Doctor.UserId;
            var busyClient = client.UserId == this.Client.UserId;

            if (occupiedRoom &&
                !dateIsNotFree &&
                (busyDoctor || busyClient))
            {
                return(true);
            }
            else if (!dateIsNotFree && (busyDoctor || busyClient))
            {
                return(true);
            }

            return(false);
        }
        internal Appointment(Client client, Doctor doctor, AppointmentDate appointmentDate)
        {
            Guard.AgainstNullObject <InvalidClientException>(client, nameof(client));
            Guard.AgainstNullObject <InvalidAppointmentDateException>(appointmentDate, nameof(appointmentDate));

            this.AppointmentDate = appointmentDate;
            this.Client          = client;
            this.Doctor          = doctor;
        }
        //Metodo para interactuar
        public Boolean FillformDate(string sDate, string patientID, string doctorID, string observations)
        {
            AppointmentDate.SendKeys(sDate);
            PatientID.SendKeys(patientID);
            DoctorId.SendKeys(doctorID);
            Observaciones.SendKeys(observations);
            GuardarBTN.Click();

            return(true);
        }
Beispiel #5
0
        public string ShowInfo()
        {
            StringBuilder textResult = new StringBuilder();

            textResult.AppendLine($"Appointment Id: {AppId}");
            textResult.AppendLine($"Date: {AppointmentDate.ToShortDateString()}");
            textResult.AppendLine($"Time: {AppointmentTime.ToShortTimeString()}");
            textResult.AppendLine($"Room: {MeetingRoom}");
            textResult.AppendLine($"Lawyer's ID: {LawyerId}");
            textResult.AppendLine($"Client's ID: {ClientId}");
            textResult.AppendLine("*************************");

            return(textResult.ToString());
        }
Beispiel #6
0
        public bool IsAbleToSchedule(HashSet <Appointment> appointments)
        {
            Console.WriteLine(Client);

            foreach (Appointment appointment in appointments)
            {
                TimeSpan ts = AppointmentDate.Subtract(appointment.AppointmentDate);
                if (ts.TotalHours < 1 && ts.TotalHours > -1)
                {
                    return(false);
                }
            }
            return(true);
        }
        /// <summary>
        /// 获得上市公司高管信息字符串
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string str = $"[{CodeTS}]{Name}\n";

            str += $"公告日期: {AnnouncementDate?.ToString("yyyy-MM-dd")}\n";
            str += $"性别: {Enum.GetName(typeof(Gender), Gender)}\n";
            str += $"职务:{Position}({PositionType})\n";
            str += $"学历: {Education}\n";
            str += $"国籍: {Nationality}\n";
            str += $"出生年月: {Birthday?.ToString("yyyy-MM")}({(int)((DateTime.Today - (Birthday??DateTime.Now)).TotalDays / 365)})\n";
            str += $"上任日期: {AppointmentDate?.ToString("yyyy-MM-dd")}\n";
            str += $"离任日期: {DepartureDate?.ToString("yyyy-MM-dd")}\n";
            str += $"个人简历: {Resume}\n";

            return(str);
        }
        public override string ToString()
        {
            if (String.IsNullOrEmpty(Description))
            {
                if (String.IsNullOrEmpty(Title))
                {
                    return($"{AppointmentDate.ToShortDateString()} {AppointmentDate.ToShortTimeString()}");
                }
                return(Title);
            }

            if (String.IsNullOrEmpty(Title))
            {
                return(Description);
            }
            return($"{Title} - {Description}");
        }
        internal Appointment(
            Doctor doctor,
            Client client,
            AppointmentDate appointmentDate,
            OfficeRoom officeRoom)
        {
            Guard.AgainstNullObject <InvalidDoctorException>(doctor, nameof(doctor));
            Guard.AgainstNullObject <InvalidClientException>(client, nameof(client));
            Guard.AgainstNullObject <InvalidAppointmentDateException>(appointmentDate, nameof(appointmentDate));
            Guard.AgainstNullObject <InvalidOfficeRoomException>(officeRoom, nameof(officeRoom));

            if (officeRoom.OfficeRoomType == OfficeRoomType.SurgeryRoom && doctor.DoctorType.Value != 2)
            {
                throw new InvalidDoctorException("Doctor: surgery room requires specialist");
            }

            this.Doctor          = doctor;
            this.Client          = client;
            this.AppointmentDate = appointmentDate;
            this.OfficeRoom      = officeRoom;
        }
Beispiel #10
0
 public Encounter GetEncounter()
 {
     return(Patient.Encounters.Where(e => (e.EncounterDate >= AppointmentDate.AddDays(1) && e.EncounterDate <= AppointmentDate.AddDays(5))).FirstOrDefault());
 }
Beispiel #11
0
 /*------------------------------------------------------------------------------*/
 //Methods:
 public override string ToString()
 {
     return(AppointmentDate.ToShortDateString());
 }
 public IAppointmentFactory WithAppointmentDate(DateTime startDate, DateTime endDate)
 {
     this.appointmentDate = new AppointmentDate(startDate, endDate);
     return(this);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            try {
                CustomerNum = util.GetCustomerNum(Message);
                if (CustomerNum == 0)
                {
                    return;
                }
                #region process dates
                int      Year            = 0;
                int      Month           = 0;
                int      Day             = 0;
                DateTime AppointmentDate = DateTime.MinValue;
                if (Request["year"] != null && Request["month"] != null && Request["day"] != null)
                {
                    Int32.TryParse(Request["year"].ToString().Trim(), out Year);
                    Int32.TryParse(Request["month"].ToString().Trim(), out Month);
                    Int32.TryParse(Request["day"].ToString().Trim(), out Day);
                    AppointmentDate = new DateTime(Year, Month, Day);
                }
                else
                {
                    //dennis set cookies here this would be read by javascript on the client browser.
                    HttpCookie DemoDateCookieY = new HttpCookie("DemoDateCookieY");
                    HttpCookie DemoDateCookieM = new HttpCookie("DemoDateCookieM");
                    HttpCookie DemoDateCookieD = new HttpCookie("DemoDateCookieD");
                    if (CustomerNum == util.GetDemoDentalOfficeID())
                    {
                        AppointmentDate       = util.GetDemoTodayDate();                        //for demo only. The date is set to a preset date in webconfig.
                        DemoDateCookieY.Value = AppointmentDate.Year + "";
                        DemoDateCookieM.Value = AppointmentDate.Month + "";
                        DemoDateCookieD.Value = AppointmentDate.Day + "";
                    }
                    else
                    {
                        DemoDateCookieY.Value = "";                              // these are explicitely set to empty, because the javascript on the browser is picking values from previously set cookies
                        DemoDateCookieM.Value = "";
                        DemoDateCookieD.Value = "";
                        AppointmentDate       = DateTime.Today;
                    }
                    Response.Cookies.Add(DemoDateCookieY);                            // if expiry is not specified the cookie lasts till the end of session
                    Response.Cookies.Add(DemoDateCookieM);
                    Response.Cookies.Add(DemoDateCookieD);
                }
                DayLabel.Text = AppointmentDate.ToString("ddd") + ", " + AppointmentDate.ToString("MMM") + AppointmentDate.ToString("dd");
                DateTime PreviousDate = AppointmentDate.AddDays(-1);
                PreviousDateDay   = PreviousDate.Day;
                PreviousDateMonth = PreviousDate.Month;
                PreviousDateYear  = PreviousDate.Year;
                DateTime NextDate = AppointmentDate.AddDays(1);
                NextDateDay   = NextDate.Day;
                NextDateMonth = NextDate.Month;
                NextDateYear  = NextDate.Year;
                #endregion

                #region process providers
                long ProvNum = 0;
                if (Request["ProvNum"] == null)
                {
                    if (Session["ProvNum"] != null)
                    {
                        Int64.TryParse(Session["ProvNum"].ToString(), out ProvNum);
                    }
                }
                else
                {
                    Int64.TryParse(Request["ProvNum"].ToString().Trim(), out ProvNum);
                    Session["ProvNum"] = ProvNum.ToString();
                }
                #endregion
                List <Appointmentm> appointmentmList;
                if (ProvNum == 0)
                {
                    appointmentmList = Appointmentms.GetAppointmentms(CustomerNum, AppointmentDate, AppointmentDate);
                }
                else
                {
                    appointmentmList = Appointmentms.GetAppointmentms(CustomerNum, ProvNum, AppointmentDate, AppointmentDate);
                }
                appointmentmList     = appointmentmList.Where(a => a.AptStatus != ApptStatus.UnschedList && a.AptStatus != ApptStatus.Planned).ToList();    //exclude unscheduled and planned appointments.
                Repeater1.DataSource = appointmentmList;
                Repeater1.DataBind();
            }
            catch (Exception ex) {
                LabelError.Text = Util.ErrorMessage;
                Logger.LogError(ex);
            }
        }
Beispiel #14
0
    public void Filter(AppointmentDate appointmentDate)
    {
        bool        hasOneAtLeast = false;
        CultureInfo provider      = new CultureInfo("pt-BR");

        if (appointmentsCell != null && appointmentsCell.Count > 0)
        {
            switch (appointmentDate)
            {
            case AppointmentDate.Today:
                nullListMessage.GetComponent <Text> ().text = todayNullMessage;
                appointmentsCell.ForEach(x => {
                    DateTime data = DateTime.ParseExact(x.GetComponent <MyAppointmentController> ().appointment.data, Constants.dateformat, provider);
                    DateTime now  = DateTime.Now;
                    if (data.Day == now.Day && data.Month == now.Month && data.Year == now.Year)
                    {
                        hasOneAtLeast = true;
                        x.SetActive(true);
                    }
                    else
                    {
                        x.SetActive(false);
                    }
                });
                break;

            case AppointmentDate.Week:
                nullListMessage.GetComponent <Text> ().text = weekNullMessage;
                appointmentsCell.ForEach(x => {
                    DateTime data = DateTime.ParseExact(x.GetComponent <MyAppointmentController> ().appointment.data, Constants.dateformat, provider);
                    if ((data - DateTime.Now).TotalDays <= 7)
                    {
                        hasOneAtLeast = true;
                        x.SetActive(true);
                    }
                    else
                    {
                        x.SetActive(false);
                    }
                });
                break;

            case AppointmentDate.All:
                nullListMessage.GetComponent <Text> ().text = allNullMessage;
                appointmentsCell.ForEach(x => {
                    hasOneAtLeast = true;
                    x.SetActive(true);
                });
                break;
            }
        }

        if (!hasOneAtLeast)
        {
            nullListMessage.SetActive(true);
        }
        else
        {
            nullListMessage.SetActive(false);
        }
    }
Beispiel #15
0
 } = "";                                        //decided that time should be separate field.
 public override string ToString()
 {
     return($"{Title} on {AppointmentDate.ToShortDateString()}.  Reminder at {ReminderTime} ");
 }