コード例 #1
0
        /// <summary>
        /// Gets the time at a certain index
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public DateTime GetTime(int index)
        {
            switch (TimeStepSize)
            {
            case TimeStepUnit.Year:
                return(StartTime.AddYears(TimeStepMultiplier * index));

            case TimeStepUnit.Month:
                return(StartTime.AddMonths(TimeStepMultiplier * index));

            case TimeStepUnit.Day:
                return(StartTime.AddDays(TimeStepMultiplier * index));

            case TimeStepUnit.Hour:
                return(StartTime.AddHours(TimeStepMultiplier * index));

            case TimeStepUnit.Minute:
                return(StartTime.AddMinutes(TimeStepMultiplier * index));

            case TimeStepUnit.Second:
                return(StartTime.AddSeconds(TimeStepMultiplier * index));

            case TimeStepUnit.None:
            default:
                return(DateTime.MinValue);
            }
        }
コード例 #2
0
ファイル: SkillQueue.cs プロジェクト: peterhaneve/evemon5
        /// <summary>
        /// Calculates the UTC time when the training of this entry completes as based on the
        /// current character training the skill. Used when the queue is paused.
        /// </summary>
        /// <param name="trainingCharacter">The character which is training this skill.</param>
        public DateTime GetCalculatedEndTime(Character trainingCharacter)
        {
            double spPerHour = trainingCharacter.CloneState.TrainingRateMultiplier *
                               trainingCharacter.Attributes.GetSPPerHour(TargetLevel.BaseSkill);

            return((spPerHour > 0.0) ? StartTime.AddHours((TargetLevel.SkillPoints - StartSP.
                                                           SkillPoints) / spPerHour) : DateTime.MaxValue);
        }
コード例 #3
0
ファイル: Raid.cs プロジェクト: Linaith/raidbot
 private void AddMessageDetails(ref EmbedBuilder embed)
 {
     embed.AddField("Date", $"{StartTime.ToLongDateString()}");
     embed.AddField("Time", $"from: {StartTime.ToShortTimeString()}  to: {StartTime.AddHours(RaidDuration).ToShortTimeString()}");
     embed.AddField("Organisator", Organisator, true);
     embed.AddField("Guild", Guild, true);
     embed.AddField("Voice chat", VoiceChat, true);
 }
コード例 #4
0
 // constructor
 public Options()
 {
     // set default values
     MinutesPerWindow = 5;
     GuestsPerWindow  = 5;
     StartTime        = DateTime.Now;
     EndTime          = StartTime.AddHours(4);
     TicketNumber     = 1;
 }
コード例 #5
0
 public Event()
 {
     Id        = Guid.NewGuid().ToString();
     User      = "";
     Text      = "";
     DueDate   = DateTime.Today;
     StartTime = DueDate;
     EndTime   = StartTime.AddHours(1);
     Type      = 1;
 }
コード例 #6
0
 /// <summary>
 /// Gets an estimated end time for the match or tournament based on the start time and a typical duration
 /// </summary>
 /// <returns></returns>
 public DateTimeOffset EstimatedEndTime()
 {
     if (StartTimeIsKnown)
     {
         return((MatchType == null) ? StartTime.AddHours(7) : StartTime.AddMinutes(90));
     }
     else
     {
         return(StartTime.AddDays(1));
     }
 }
コード例 #7
0
        /// <summary>
        /// Returns the ICalendar item
        /// </summary>
        /// <returns>a string output of the ICalendar item</returns>
        public virtual string GetICalendar()
        {
            StringBuilder FileOutput = new StringBuilder();

            FileOutput.AppendLine("BEGIN:VCALENDAR");
            FileOutput.AppendLine("PRODID:-//Craigs Utility Library//EN");
            FileOutput.AppendLine("VERSION:2.0");
            FileOutput.AppendLine("METHOD:PUBLISH");
            StartTime = StartTime.AddHours(-TimeZoneAdjustment);
            EndTime   = EndTime.AddHours(-TimeZoneAdjustment);
            string Start = StartTime.ToString("yyyyMMdd") + "T" + StartTime.ToString("HHmmss");
            string End   = EndTime.ToString("yyyyMMdd") + "T" + EndTime.ToString("HHmmss");

            FileOutput.AppendLine("BEGIN:VEVENT");
            FileOutput.AppendLine("CLASS:PUBLIC");
            FileOutput.Append("CREATED:").AppendLine(DateTime.Now.ToString("yyyyMMddTHHmmssZ"));
            FileOutput.AppendLine(StripHTML(Description.Replace("<br />", "\\n")));
            FileOutput.Append("DTEND:").AppendLine(Start);
            FileOutput.Append("DTSTART:").AppendLine(End);
            FileOutput.Append("LOCATION:").AppendLine(Location);
            FileOutput.Append("SUMMARY;LANGUAGE=en-us:").AppendLine(Subject);
            FileOutput.Append("UID:").Append(Start).Append(End).AppendLine(Subject);
            if (ContainsHTML(Description))
            {
                FileOutput.Append("X-ALT-DESC;FMTTYPE=text/html:").AppendLine(Description.Replace("\n", ""));
            }
            else
            {
                FileOutput.Append("DESCRIPTION:").AppendLine(Description);
            }
            FileOutput.AppendLine("BEGIN:VALARM");
            FileOutput.AppendLine("TRIGGER:-PT15M");
            FileOutput.AppendLine("ACTION:DISPLAY");
            FileOutput.AppendLine("DESCRIPTION:Reminder");
            FileOutput.AppendLine("END:VALARM");
            FileOutput.AppendLine("END:VEVENT");
            FileOutput.AppendLine("END:VCALENDAR");
            return(FileOutput.ToString());
        }
コード例 #8
0
        public NewEditActivityViewModel(IController controller, Employee employee, Activity activity = null) : base(controller)
        {
            _controller = controller;
            _employee   = employee;

            if (activity == null)
            {
                Date       = DateTime.Now;
                StartTime  = DateTime.Now;
                EndTime    = StartTime.AddHours(1);
                HeaderText = "Neue Tätigkeit anlegen für:";
            }
            else
            {
                Date         = activity.Date;
                StartTime    = activity.StartTime;
                EndTime      = activity.EndTime;
                ActivityText = activity.ActivityText;
                _activity    = activity;
                HeaderText   = "Tätigkeit bearbeiten von:";
            }
        }
コード例 #9
0
        /// <summary>
        /// Returns the VCalendar item
        /// </summary>
        /// <returns>a string output of the VCalendar item</returns>
        public virtual string GetVCalendar()
        {
            StringBuilder FileOutput = new StringBuilder();

            FileOutput.AppendLine("BEGIN:VCALENDAR");
            FileOutput.AppendLine("VERSION:1.0");
            FileOutput.AppendLine("BEGIN:VEVENT");
            StartTime = StartTime.AddHours(-TimeZoneAdjustment);
            EndTime   = EndTime.AddHours(-TimeZoneAdjustment);

            string Start = StartTime.ToString("yyyyMMdd") + "T" + StartTime.ToString("HHmmss");
            string End   = EndTime.ToString("yyyyMMdd") + "T" + EndTime.ToString("HHmmss");

            FileOutput.Append("DTStart:").AppendLine(Start);
            FileOutput.Append("DTEnd:").AppendLine(End);
            FileOutput.Append("Location;ENCODING=QUOTED-PRINTABLE:").AppendLine(Location);
            FileOutput.Append("SUMMARY;ENCODING=QUOTED-PRINTABLE:").AppendLine(Subject);
            FileOutput.Append("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:").AppendLine(Description);
            FileOutput.Append("UID:").Append(Start).Append(End).AppendLine(Subject);
            FileOutput.AppendLine("PRIORITY:3");
            FileOutput.AppendLine("End:VEVENT");
            FileOutput.AppendLine("End:VCALENDAR");
            return(FileOutput.ToString());
        }
コード例 #10
0
ファイル: HisDataQueryModel.cs プロジェクト: cdy816/mars
        /// <summary>
        ///
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        private void QueryHisData(string tag, DateTime startTime, DateTime endTime)
        {
            mIsBusy = true;

            if (!mTags.ContainsKey(mSelectTag))
            {
                return;
            }

            int      id    = mTags[mSelectTag].Item1;
            DateTime sTime = StartTime.AddHours(StartTimeHour);
            DateTime eTime = EndTime.AddHours(EndTimeHour);

            int tcount = (int)(eTime - sTime).TotalSeconds;

            switch (mTags[mSelectTag].Item2)
            {
            case (byte)Cdy.Tag.TagType.Bool:
                ProcessDataQuery <bool>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.Byte:
                ProcessDataQuery <byte>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.DateTime:
                ProcessDataQuery <DateTime>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.Double:
                ProcessDataQuery <double>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.Float:
                ProcessDataQuery <float>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.Int:
                ProcessDataQuery <int>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.Long:
                ProcessDataQuery <long>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.Short:
                ProcessDataQuery <short>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.String:
                ProcessDataQuery <string>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.UInt:
                ProcessDataQuery <uint>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.ULong:
                ProcessDataQuery <ulong>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.UShort:
                ProcessDataQuery <ushort>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.IntPoint:
                ProcessDataQuery <IntPointData>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.UIntPoint:
                ProcessDataQuery <UIntPointData>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.IntPoint3:
                ProcessDataQuery <IntPoint3Data>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.UIntPoint3:
                ProcessDataQuery <UIntPoint3Data>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.LongPoint:
                ProcessDataQuery <LongPointData>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.ULongPoint:
                ProcessDataQuery <ULongPointTag>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.LongPoint3:
                ProcessDataQuery <LongPoint3Data>(id, sTime, eTime);
                break;

            case (byte)Cdy.Tag.TagType.ULongPoint3:
                ProcessDataQuery <ULongPoint3Data>(id, sTime, eTime);
                break;
            }
            mIsBusy = false;
        }
コード例 #11
0
 public bool IsLiveOrSoonToBe()
 {
     if (State != null)
     {
         if (!State.Completed && (State.IsLive || (ShowHoursBefore > 0 &&  DateTime.UtcNow > StartTime.AddHours(-ShowHoursBefore))))
         {
             return true;
         }
     }
     return false;
 }
コード例 #12
0
ファイル: TimeLine.cs プロジェクト: Hrubon/pasch
 private void btnPlus1Hour_Click(object sender, EventArgs e)
 {
     StartTime = StartTime.AddHours(ONE_HOUR);
     Redraw();
 }
コード例 #13
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            try
            {
                string    neworold = "0"; DataTable dtpSearch = new DataTable();
                DataTable dtb = this.cntrl.patient_details(txt_p_name.Text);
                Appointment_for_newPAtient(dtb);
                if (cmbStartTime.SelectedIndex <= cmbEndTime.SelectedIndex)
                {
                    if (patient_id != "0")
                    {
                        string    dr_id     = combodoctor.GetItemText(combodoctor.SelectedValue);
                        string    dr_color  = "0";
                        long      app_id    = 0;
                        DateTime  Dateonly  = DateTime.Now.Date;
                        string    dr_mobile = "0";
                        string    dr_email  = "";
                        DataTable dt_d      = this.cntrl.Get_calenderColor(dr_id);
                        if (dt_d.Rows.Count > 0)
                        {
                            dr_color  = dt_d.Rows[0][0].ToString();
                            dr_mobile = dt_d.Rows[0][1].ToString();
                            dr_email  = dt_d.Rows[0][2].ToString();
                        }
                        string   diff1      = "0";
                        DateTime StartTime1 = DateTime.Now.Date;
                        // string Stime;
                        if (EditingEvent.RecurrenceState == CalendarEventRecurrenceState.xtpCalendarRecurrenceNotRecurring ||
                            EditingEvent.RecurrenceState == CalendarEventRecurrenceState.xtpCalendarRecurrenceException)
                        {
                            DateTime StartTime, EndTime;
                            StartTime = dpStartTimeDate.Value;
                            EndTime   = dpStartTimeDate.Value;
                            StartTime = StartTime.AddHours(cmbStartTime.SelectedIndex / 12);
                            EndTime   = EndTime.AddHours(cmbEndTime.SelectedIndex / 12);
                            int st_ms = 0;
                            st_ms     = cmbStartTime.SelectedIndex % 12;
                            StartTime = StartTime.AddMinutes(st_ms * 5);
                            st_ms     = cmbEndTime.SelectedIndex % 12;
                            EndTime   = EndTime.AddMinutes(st_ms * 5);
                            EditingEvent.StartTime = StartTime;
                            EditingEvent.EndTime   = EndTime;
                            var diff = EndTime.Subtract(StartTime);
                            if (diff.Hours.ToString() != "")
                            {
                                int valh = diff.Hours;
                                valh = valh * 60;
                                int valm = diff.Minutes;
                                diff1 = Convert.ToString(valh + valm);
                            }
                            else
                            {
                                diff1 = Convert.ToString(diff.Minutes);
                            }
                            StartTime1 = StartTime;
                        }

                        DateTime Dateonly1 = DateTime.Now;

                        //if (Dateonly1 > StartTime1)
                        //{
                        //    MessageBox.Show("Appointment Date should be greater than Current Date...", "Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //    return;
                        //}
                        if (IsNewEvent)
                        {
                            DateTime StartT;
                            StartT = dpStartTimeDate.Value;
                            StartT = StartT.AddHours(cmbStartTime.SelectedIndex / 12);
                            int md = cmbStartTime.SelectedIndex % 12;
                            StartT = StartT.AddMinutes(md * 5);
                            //*********Booking Name***********//
                            string    Name   = "";
                            DataTable doctor = this.cntrl.get_doctor_login(PappyjoeMVC.Model.Connection.MyGlobals.Doctor_id);
                            if (doctor.Rows.Count > 0)
                            {
                                if (doctor.Rows[0]["login_type"].ToString() == "doctor")
                                {
                                    Name = "Dr ";
                                }

                                Name = Name + doctor.Rows[0]["doctor_name"].ToString();
                            }
                            dtpSearch = this.cntrl.patient_details_byname(txt_p_name.Text);
                            if (dtpSearch.Rows.Count <= 0)
                            {
                                this.cntrl.insappointment(Convert.ToDateTime(Dateonly).ToString("yyyy-MM-dd"), Convert.ToDateTime(StartT).ToString("yyyy-MM-dd HH:mm"), diff1, txtDescription.Text, patient_id, txt_p_name.Text, dr_id, txt_p_mobile.Text, txt_p_email.Text, compoprocedure.Text, Name);
                                this.cntrl.save_log(doctor_id, "Appointment", "logged user adds new appointment", "Add");
                            }
                            else
                            {
                                this.cntrl.insappointment(Convert.ToDateTime(Dateonly).ToString("yyyy-MM-dd"), Convert.ToDateTime(StartT).ToString("yyyy-MM-dd HH:mm"), diff1, txtDescription.Text, patient_id, patient_name, dr_id, lab_p_ph.Text, lab_p_email.Text, compoprocedure.Text, Name);
                                this.cntrl.save_log(doctor_id, "Appointment", "logged user adds new appointment", "Add");
                            }

                            DataTable dt_a = this.cntrl.appointmentId();
                            if (dt_a.Rows.Count > 0)
                            {
                                app_id = Convert.ToInt32(dt_a.Rows[dt_a.Rows.Count - 1][0].ToString());
                            }
                            EditingEvent.Subject     = patient_name;
                            EditingEvent.Location    = Convert.ToString(cmbStartTime.GetItemText(cmbStartTime.SelectedItem)) + "-" + Convert.ToString(cmbEndTime.GetItemText(cmbEndTime.SelectedItem));
                            EditingEvent.Body        = Convert.ToString(app_id);
                            EditingEvent.Label       = Convert.ToInt32(dr_color);
                            EditingEvent.AllDayEvent = (chkAllDayEvent.Checked ? true : false);
                            EditingEvent.BusyStatus  = (CalendarEventBusyStatus)cmbShowTimeAs.SelectedIndex;
                            EditingEvent.PrivateFlag = (chkPrivate.Checked ? true : false);
                            EditingEvent.MeetingFlag = (chkMeeting.Checked ? true : false);
                            EditingEvent.Reminder    = chkReminder.Checked;
                            if (EditingEvent.Reminder)
                            {
                                CalReminderMinutes pRmd = (CalReminderMinutes)cmbReminder.SelectedItem;
                                if (pRmd != null)
                                {
                                    EditingEvent.ReminderMinutesBeforeStart = pRmd.m_nMinutes;
                                }
                            }
                            Main_Calendar.Instance.wndCalendarControl.DataProvider.AddEvent(EditingEvent);
                            string clinic = "", locality = "", contact_no = "";

                            System.Data.DataTable clinicname = this.cntrl.clinicdetails();
                            clinic     = clinicname.Rows[0]["name"].ToString();
                            contact_no = clinicname.Rows[0]["contact_no"].ToString();
                            if (checkBox1.Checked)
                            {
                                string    text = "";
                                string    smsName = "", smsPass = "";
                                DataTable sms = this.cntrl.smsdetails();
                                if (sms.Rows.Count > 0)
                                {
                                    smsName = sms.Rows[0]["smsName"].ToString();
                                    smsPass = sms.Rows[0]["smsPass"].ToString();
                                }
                                SMS_model a           = new SMS_model();
                                DataTable pat         = this.cntrl.Get_Patient_Details(patient_id);
                                DataTable smsreminder = this.cntrl.Get_reminderSmS();
                                DataTable smslanguage = this.cntrl.sms_lang();
                                if (smsreminder.Rows.Count > 0)
                                {
                                    send_on_day     = smsreminder.Rows[0]["send_on_day"].ToString();
                                    send_before_day = smsreminder.Rows[0]["send_before_day"].ToString();
                                    day_time        = smsreminder.Rows[0]["day_time"].ToString();
                                    before_time     = smsreminder.Rows[0]["day_time"].ToString();
                                }
                                if (pat.Rows.Count > 0)
                                {
                                    string number = "91" + pat.Rows[0]["primary_mobile_number"].ToString();
                                    string type   = "LNG";
                                    if (neworold == "1")
                                    {
                                        a.SendSMS(smsName, smsPass, number, "Dear " + pat.Rows[0]["pt_name"].ToString() + " welcome to " + clinic + "," + contact_no, type);
                                    }
                                    if (smslanguage.Rows.Count > 0)
                                    {
                                        string    smslang     = smslanguage.Rows[0]["Prescription_lang"].ToString();
                                        DataTable smstemplate = this.cntrl.smstemplate(smslang, pat.Rows[0]["pt_name"].ToString(), compoprocedure.Text, StartT.ToString("dd/MM/yyyy"), cmbStartTime.Text, combodoctor.Text, clinic, contact_no);
                                        if (smstemplate.Rows.Count > 0)
                                        {
                                            text = smstemplate.Rows[0]["Template"].ToString();
                                            a.SendSMS(smsName, smsPass, number, text, type);
                                            this.cntrl.save_Pt_SMS(patient_id, pat.Rows[0]["pt_name"].ToString(), compoprocedure.Text, StartT.ToString("dd/MM/yyyy"), cmbStartTime.Text, combodoctor.Text);
                                        }//
                                    }
                                    string sddsds = "";
                                    //text = "Dear " + pat.Rows[0]["pt_name"].ToString() + " " + "Your appointment for " + compoprocedure.Text + " has been confirmed at " + StartT.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " with " + "Dr " + combodoctor.Text + " Regards " + clinic + "," + contact_no;
                                    //a.SendSMS(smsName, smsPass, number, text);
                                    //this.cntrl.save_Pt_SMS(patient_id, pat.Rows[0]["pt_name"].ToString(), compoprocedure.Text, StartT.ToString("dd/MM/yyyy"), cmbStartTime.Text, combodoctor.Text);
                                    ////For Reminder SMS-----
                                    if (day_time != null)
                                    {
                                        if (dpStartTimeDate.Value > DateTime.Now.Date)
                                        {
                                            text = "Dear " + pat.Rows[0]["pt_name"].ToString() + ", " + "Today you have an appointment at " + clinic + " on " + StartT.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " for " + compoprocedure.Text + " .Regards  " + clinic + "," + contact_no;
                                            a.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT.ToString("dd/MM/yyyy") + " 09:10:00 am", DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                                        }
                                    }
                                    if (before_time != null)
                                    {
                                        if (dpStartTimeDate.Value > DateTime.Now.Date)
                                        {
                                            text = "Dear " + pat.Rows[0]["pt_name"].ToString() + ", " + "Today you have an appointment at " + clinic + " on " + StartT.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " for " + compoprocedure.Text + " .Regards  " + clinic + "," + contact_no;
                                            a.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT.ToString("dd/MM/yyyy") + before_time, DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                                        }
                                    }
                                }
                            }

                            if (checkBox3.Checked)
                            {
                                if (dr_mobile != "0")
                                {
                                    string    text = "";
                                    string    smsName = "", smsPass = "";
                                    SMS_model a      = new SMS_model();
                                    string    number = "91" + dr_mobile;
                                    string    type   = "LNG";
                                    text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + txt_p_name.Text + " for " + compoprocedure.Text + " at " + clinic + "," + contact_no;
                                    a.SendSMS(smsName, smsPass, number, text, type);
                                    //For Remainder SMS
                                    if (day_time != null)
                                    {
                                        if (dpStartTimeDate.Value > DateTime.Now.Date)
                                        {
                                            text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + txt_p_name.Text + " for " + compoprocedure.Text + " at " + clinic + "," + contact_no;
                                            // a.SendSMS(smsName, smsPass, number, text);
                                            a.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT.ToString("dd/MM/yyyy") + " 09:10:00 am", DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                                        }
                                    }
                                    if (before_time != null)
                                    {
                                        if (dpStartTimeDate.Value > DateTime.Now.Date)
                                        {
                                            text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + txt_p_name.Text + " for " + compoprocedure.Text + " at " + clinic + "," + contact_no;
                                            a.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT.ToString("dd/MM/yyyy") + before_time, DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                                        }
                                    }
                                }
                            }

                            if (checkBox2.Checked)
                            {
                                string email = "", emailName = "", emailPass = "";

                                string query = "select email_address,pt_name from tbl_patient where id='" + patient_id + "'";

                                DataTable sr = this.cntrl.getpatemail(patient_id);
                                if (sr.Rows.Count > 0)
                                {
                                    email = sr.Rows[0]["email_address"].ToString();
                                    DataTable sms = this.cntrl.send_email();
                                    if (sms.Rows.Count > 0)
                                    {
                                        emailName = sms.Rows[0]["emailName"].ToString();
                                        emailPass = sms.Rows[0]["emailPass"].ToString();

                                        try
                                        {
                                            string      sr1     = "<table align='center' style='width:700px;border: 1px solid ;border-collapse: collapse; background: #EAEAEA; height:500px'><tr><td  align='left' height='27'><FONT  color='#666666'  face='Arial' SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Appointment Reminder:" + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + " @ " + clinic + "</font></td></tr><tr><td  align='left' height='400px'><table  height='423' align='center' style='width:600px; background: #FFFFFF; height:400px'><tr><td  align='left' height='6px'><FONT  color='#000000'  face='Arial' SIZE=6>" + clinic + "</font></td></tr><tr><td  align='left' height='1px' bgcolor='#666666'></td></tr><tr><td  align='left' height='62' valign='bottom'><FONT  color='#000000'  face='Arial' SIZE=3>Good morning <b>" + sr.Rows[0]["pt_name"].ToString() + "</b></font></td></tr> <tr><td align='left' height='197' valign='top'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Just to remind you about your appointment at " + clinic + ".<table><tbody><tr><td width='188' height='31' valign='bottom' align='right'>WHEN :</td><td width='30' height='31' valign='bottom' align='right'></td><td width='358' valign='bottom'> <strong>" + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + "</strong></td>  </tr><tr><td height='76' valign='top'  align='right'>WHERE :</td><td width='30' height='31' valign='bottom' align='right'></td><td  valign='top'>" + locality + "</td></tr></tbody></table> For any queries, contact us at : " + contact_no + "</td>  </tr><tr><td  align='left' height='1px' bgcolor='#666666'></td></tr> <tr><td height='25'  align='right' valign='bottom'>Powered by&nbsp;&nbsp; </td></tr> <tr><td height='81'  align='right' valign='top'><img src='http://pappyjoe.com/assets/images/pappyjoe-logo.PNG' alt='pappyjoe official logo'>&nbsp;&nbsp;</td></tr></table></td></tr></table>";
                                            MailMessage message = new MailMessage();
                                            message.From = new MailAddress(email);
                                            message.To.Add(email);
                                            message.BodyEncoding = System.Text.Encoding.GetEncoding(1252); //bijeesh
                                            message.IsBodyHtml   = true;                                   //bijeesh
                                            SmtpClient smtp = new SmtpClient("smtp.gmail.com");
                                            message.Subject            = "Appointment Reminder: " + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + " @ " + clinic;
                                            message.Body               = sr1.ToString();
                                            smtp.Port                  = 587;
                                            smtp.Host                  = "smtp.gmail.com";
                                            smtp.EnableSsl             = true;
                                            smtp.UseDefaultCredentials = false;
                                            smtp.Credentials           = new System.Net.NetworkCredential(emailName, emailPass);
                                            smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
                                            smtp.Send(message);
                                        }
                                        catch (Exception ex)
                                        {
                                        }
                                    }
                                }
                            }
                            if (checkBox4.Checked) // Doctor Email
                            {
                                string emailName = "", emailPass = "";
                                if (dr_email != "")
                                {
                                    DataTable sms = this.cntrl.send_email();
                                    if (sms.Rows.Count > 0)
                                    {
                                        emailName = sms.Rows[0]["emailName"].ToString();
                                        emailPass = sms.Rows[0]["emailPass"].ToString();
                                        try
                                        {
                                            string      sr1     = "<table align='center' style='width:700px;border: 1px solid ;border-collapse: collapse; background: #EAEAEA; height:500px'><tr><td  align='left' height='27'><FONT  color='#666666'  face='Arial' SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Appointment Reminder:" + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + " @ " + clinic + "</font></td></tr><tr><td  align='left' height='400px'><table  height='423' align='center' style='width:600px; background: #FFFFFF; height:400px'><tr><td  align='left' height='6px'><FONT  color='#000000'  face='Arial' SIZE=6>" + clinic + "</font></td></tr><tr><td  align='left' height='1px' bgcolor='#666666'></td></tr><tr><td  align='left' height='62' valign='bottom'><FONT  color='#000000'  face='Arial' SIZE=3>Dear <b>" + combodoctor.Text + "</b></font></td></tr> <tr><td align='left' height='197' valign='top'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Just to remind you about your appointment at " + clinic + ".<table><tbody><tr><td width='188' height='31' valign='bottom' align='right'>WHEN :</td><td width='30' height='31' valign='bottom' align='right'></td><td width='358' valign='bottom'> <strong>" + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + "</strong></td>  </tr><tr><td height='31' valign='top'  align='right'>PATIENT :</td><td width='30' height='31' valign='bottom' align='right'></td><td  valign='top'>" + txt_p_name.Text + "</td></tr><tr><td height='76' valign='top'  align='right'>FOR :</td><td width='30' height='31' valign='bottom' align='right'></td><td  valign='top'>" + compoprocedure.Text + "</td></tr></tbody></table> For any queries, contact us at : " + contact_no + "</td>  </tr><tr><td  align='left' height='1px' bgcolor='#666666'></td></tr> <tr><td height='25'  align='right' valign='bottom'>Powered by&nbsp;&nbsp; </td></tr> <tr><td height='81'  align='right' valign='top'><img src='http://pappyjoe.com/assets/images/pappyjoe-logo.PNG' alt='pappyjoe official logo'>&nbsp;&nbsp;</td></tr></table></td></tr></table>";
                                            MailMessage message = new MailMessage();
                                            message.From = new MailAddress(dr_email);
                                            message.To.Add(dr_email);
                                            message.BodyEncoding = System.Text.Encoding.GetEncoding(1252); //bijeesh
                                            message.IsBodyHtml   = true;                                   //bijeesh
                                            SmtpClient smtp = new SmtpClient("smtp.gmail.com");
                                            message.Subject            = "Appointment(s) scheduled for Today: " + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + " @ " + clinic;
                                            message.Body               = sr1.ToString();
                                            smtp.Port                  = 587;
                                            smtp.Host                  = "smtp.gmail.com";
                                            smtp.EnableSsl             = true;
                                            smtp.UseDefaultCredentials = false;
                                            smtp.Credentials           = new System.Net.NetworkCredential(emailName, emailPass);
                                            smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
                                            smtp.Send(message);
                                        }
                                        catch (Exception ex)
                                        {
                                        }
                                    }
                                }
                            }// Doctor Email end
                        }
                        else
                        {
                            DateTime StartT;
                            StartT = dpStartTimeDate.Value;
                            StartT = StartT.AddHours(cmbStartTime.SelectedIndex / 12);
                            int md = cmbStartTime.SelectedIndex % 12;
                            StartT = StartT.AddMinutes(md * 5);
                            EditingEvent.Subject  = patient_name;
                            EditingEvent.Location = Convert.ToString(cmbStartTime.GetItemText(cmbStartTime.SelectedItem)) + "-" + Convert.ToString(cmbEndTime.GetItemText(cmbEndTime.SelectedItem));
                            EditingEvent.Body     = Convert.ToString(gpl_app_id);
                            EditingEvent.Label    = Convert.ToInt32(dr_color);
                            if (cmbStartTime.SelectedIndex % 2 > 0)
                            {
                                StartT = StartT.AddMinutes(30);
                            }
                            this.cntrl.update_appointment(Convert.ToDateTime(StartT), diff1, txtDescription.Text, compoprocedure.Text, patient_id, patient_name, dr_id, lab_p_ph.Text, lab_p_email.Text, gpl_app_id);
                        }
                        EditingEvent = null;
                        Main_Calendar.Instance.ContextEvent = null;
                        Main_Calendar.Instance.wndCalendarControl.Populate();
                        Main_Calendar.Instance.wndCalendarControl.RedrawControl();
                        if (Convert.ToDateTime(DateTime.Today.ToString("d")) == dpStartTimeDate.Value)
                        {
                            Main_Calendar.Instance.listAppointment("0");
                        }
                        this.Close();
                        Main_Calendar.Instance.Activate();
                    }
                    else
                    {
                    }
                }
                else
                {
                    MessageBox.Show("Appointment Date should be greater than Current Date...", "Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                if (dtpSearch.Rows.Count <= 0)
                {
                    status1 = 1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #14
0
        //Note Add a new event
        private void cmdOK_Click(object sender, System.EventArgs e)
        {
            if (EditingEvent.RecurrenceState == CalendarEventRecurrenceState.xtpCalendarRecurrenceNotRecurring ||
                EditingEvent.RecurrenceState == CalendarEventRecurrenceState.xtpCalendarRecurrenceException)
            {
                DateTime StartTime, EndTime;

                StartTime = dpStartTimeDate.Value;
                EndTime   = dpEndTimeDate.Value;

                StartTime = StartTime.AddHours(cmbStartTime.SelectedIndex / 2);
                EndTime   = EndTime.AddHours(cmbEndTime.SelectedIndex / 2);

                if (cmbStartTime.SelectedIndex % 2 > 0)
                {
                    StartTime = StartTime.AddMinutes(30);
                }

                if (cmbEndTime.SelectedIndex % 2 > 0)
                {
                    EndTime = EndTime.AddMinutes(30);
                }

                EditingEvent.StartTime = StartTime;
                EditingEvent.EndTime   = EndTime;
            }

            EditingEvent.Subject  = txtSubject.Text;
            EditingEvent.Location = txtLocation.Text;
            EditingEvent.Body     = txtDescription.Text;

            EditingEvent.AllDayEvent = (chkAllDayEvent.Checked ? true : false);
            EditingEvent.Label       = cmbLabel.SelectedIndex;
            EditingEvent.BusyStatus  = (CalendarEventBusyStatus)cmbShowTimeAs.SelectedIndex;

            EditingEvent.PrivateFlag = (chkPrivate.Checked ? true : false);
            EditingEvent.MeetingFlag = (chkMeeting.Checked ? true : false);

            EditingEvent.Reminder = chkReminder.Checked;
            if (EditingEvent.Reminder)
            {
                CalReminderMinutes pRmd = (CalReminderMinutes)cmbReminder.SelectedItem;
                if (pRmd != null)
                {
                    EditingEvent.ReminderMinutesBeforeStart = pRmd.m_nMinutes;
                }
            }

            if (IsNewEvent)
            {
                frmMain.Instance.wndCalendarControl.DataProvider.AddEvent(EditingEvent);
            }
            else
            {
                frmMain.Instance.wndCalendarControl.DataProvider.ChangeEvent(EditingEvent);
            }

            EditingEvent = null;
            frmMain.Instance.ContextEvent = null;

            frmMain.Instance.wndCalendarControl.Populate();
            frmMain.Instance.wndCalendarControl.RedrawControl();

            this.Close();

            frmMain.Instance.Activate();
        }