示例#1
0
        public async Task <IActionResult> OnPostTimeFrame(string selectedTimeFrame)
        {
            SelectedTimeFrame = selectedTimeFrame;
            var splitSelectedTimeFrame = SelectedTimeFrame.Split("-");

            PopulateTimeFrameDropDownList(_context, splitSelectedTimeFrame[0]);

            StartTime = DateTimeOffset.Parse(splitSelectedTimeFrame[0]);
            EndTime   = DateTimeOffset.Parse(splitSelectedTimeFrame[1]);
            EndTime   = EndTime.AddHours(23).AddMinutes(59).AddSeconds(59).AddMilliseconds(999);

            Rate = 37.5M;
            var p = new object[]
            {
                new SqlParameter("@p0", SqlDbType.DateTimeOffset, 7)
                {
                    Value = StartTime
                },
                new SqlParameter("@p1", SqlDbType.DateTimeOffset, 7)
                {
                    Value = EndTime
                },
                new SqlParameter("@p2", SqlDbType.Money, 4)
                {
                    Value = Rate
                },
                new SqlParameter("@p3", SqlDbType.Bit, 1)
                {
                    Value = true
                }
            };

            Clients = await _context.Clients.ToListAsync();

            Projects = await _context.Projects.ToListAsync();

            ActivityTypes = await _context.ActivityTypes.ToListAsync();

            Report = await _context
                     .Report
                     .FromSqlRaw("execute sp_Report @p0, @p1, @p2, @p3", p)
                     .TagWith("my statement")
                     .ToListAsync();

            ReportDetails = await _context.ReportDetails
                            .FromSqlRaw("execute sp_ReportDetails @p0, @p1, @p2, @p3", p)
                            .TagWith("my second statement")
                            .ToListAsync();

            ReportDetailsByDay = await _context.ReportDetailsByDay
                                 .FromSqlRaw("execute sp_ReportDetailsByDay @p0, @p1, @p2, @p3", p)
                                 .TagWith("my second statement")
                                 .ToListAsync();

            //ActivityEntities = await PopulateActivityEntities(StartTime, EndTime);
            return(Page());
        }
示例#2
0
 public bool ShowAsReference(int delay)
 {
     if (State != null)
     {
         if (State.Completed && DateTime.UtcNow < EndTime.AddHours(delay))
         {
             return true;
         }
     }
     return false;
 }
示例#3
0
        public FarmOverview(string farmLabel)
        {
            FarmLabel = farmLabel;
            EndTime   = DateTime.Now;
            StartTime = EndTime.AddHours(-1); // grab 1 hours worth
            // milliseconds from epoch
            long endTime   = (long)DateTime.Now.Subtract(DateTimeUtils.EPOCH_1970).TotalMilliseconds;
            long startTime = endTime - (1000 * 60 * 60);  // grab 1 hours worth

            Probe = ProbeOverviewRequest.Get(FarmLabel, startTime, endTime);
            SQL   = SQLPerfOverviewRequest.Get(FarmLabel, startTime, endTime);
            USR   = USRandRPSPerfOverviewRequest.Get(FarmLabel, startTime, endTime);
        }
示例#4
0
 private void SetNextNotificationTime(TimeSpan time)
 {
     if (time.TotalHours > 3)
     {
         // the first notification is 3 hours before the timer expires.
         NextNotificationTime = EndTime.AddHours(-3);
     }
     else
     {
         if (time.TotalMinutes > 60)
         {
             NextNotificationTime = EndTime.AddHours(-1);
         }
         else
         {
             if (time.TotalMinutes > 30)
             {
                 NextNotificationTime = EndTime.AddMinutes(-30);
             }
             else
             {
                 if (time.TotalMinutes > 15)
                 {
                     NextNotificationTime = EndTime.AddMinutes(-15);
                 }
                 else
                 {
                     if (time.TotalMinutes > 5)
                     {
                         NextNotificationTime = EndTime.AddMinutes(-5);
                     }
                     else
                     {
                         if (time.TotalMinutes > 1)
                         {
                             NextNotificationTime = EndTime.AddMinutes(-1);
                         }
                         else
                         {
                             NextNotificationTime = EndTime;
                         }
                     }
                 }
             }
         }
     }
 }
示例#5
0
        /// <summary>
        /// 计算安全历史得分
        /// </summary>
        /// <param name="StartDateTime">开始时间</param>
        /// <param name="EndDateTime">结束时间</param>
        public void ArchiveCalculation(DateTime StartDateTime, DateTime EndDateTime)
        {
            IsCalcShift = false;
            DateTime StartTime, EndTime;
            decimal  StartHour, EndHour, PeriodEndHour, Hours;
            List <KPI_PeriodEntity> list = KPI_PeriodDal.GetPeriodEntityList();
            KPI_PeriodEntity        item;

            //String format = "开始时间:{0} 结束时间:{1}";
            while (StartDateTime < EndDateTime)
            {
                StartTime = StartDateTime;
                EndTime   = StartDateTime.AddHours(1);
                StartHour = StartTime.Hour + StartTime.Minute / 60.0m;
                EndHour   = EndTime.Hour + EndTime.Minute / 60.0m;
                item      = list.Where(p => ((EndHour - p.PeriodEndHour) <= 8.0m) &&
                                       ((EndHour - p.PeriodEndHour) >= -0.5m) && (p.PeriodHours > 0)).First();
                PeriodEndHour = item.PeriodEndHour;
                Hours         = EndHour - PeriodEndHour;
                if ((Hours > 0) && (Hours < 1.0m))
                {
                    StartTime = EndTime.AddHours(-1 * Convert.ToDouble(Hours));
                    //Console.WriteLine(String.Format(format, StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    //    EndTime.ToString("yyyy-MM-dd HH:mm:ss")));
                    CalculateSAScore(StartTime, EndTime);                    //计算当前值安全得分

                    //计算前值安全得分
                    EndTime   = StartTime;
                    Hours     = 1.0m - Hours;
                    StartTime = EndTime.AddHours(-1 * Convert.ToDouble(Hours));
                    //Console.WriteLine(String.Format(format, StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    //    EndTime.ToString("yyyy-MM-dd HH:mm:ss")));
                    CalculateSAScore(StartTime, EndTime);
                }
                if ((Hours >= 1.0m) || ((Hours <= 0) && (Hours >= -0.5m)))
                {
                    CalculateSAScore(StartTime, EndTime);                    //计算当前值安全得分
                    //Console.WriteLine(String.Format(format, StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    //    EndTime.ToString("yyyy-MM-dd HH:mm:ss")));
                }
                StartDateTime = StartDateTime.AddHours(1);
            }
        }
        /// <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());
        }
        /// <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());
        }
示例#8
0
        /// <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;
        }
示例#9
0
 public void getappointment(DataTable dt)
 {
     try
     {
         string dr_color = "0", dr_mobile = "0", dr_email = "";
         if (dt.Rows.Count > 0)
         {
             dr_color  = dt.Rows[0]["calendar_color"].ToString();
             name      = "Dr " + dt.Rows[0]["doctor_name"].ToString();
             dr_mobile = dt.Rows[0]["mobile_number"].ToString();
             dr_email  = dt.Rows[0]["email_id"].ToString();
         }
         Dateonly = Convert.ToDateTime(DateTime.Now.ToLocalTime());
         DateTime StartT, EndTime;
         StartT  = dpStartTimeDate.Value.Date;
         EndTime = dpStartTimeDate.Value.Date;
         StartT  = StartT.AddHours(cmbStartTime.SelectedIndex / 12);
         EndTime = EndTime.AddHours(cmbEndTime.SelectedIndex / 12);
         int md    = cmbStartTime.SelectedIndex % 12;
         int en_ms = cmbEndTime.SelectedIndex % 12;
         StartT1 = StartT.AddMinutes(md * 5);
         EndTime = EndTime.AddMinutes(en_ms * 5);
         var diff = EndTime.Subtract(StartT);
         diff1 = Convert.ToString(diff.Minutes);
         if (Dateonly > StartT)
         {
             MessageBox.Show("Appointment Date should be greater than Current Date...", "Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             if (cmbStartTime.SelectedIndex <= cmbEndTime.SelectedIndex)
             {
                 if (appointment_id != "")
                 {
                     j = this.ctrlr.apntupdate(Convert.ToDateTime(StartT1).ToString("yyyy-MM-dd HH:mm"), diff1, txtDescription.Text, dr_id, compoprocedure.Text, name, appointment_id);
                     this.ctrlr.save_log(doctor_id, "Appointment", "logged user edits appointment", "Edit");
                 }
                 else
                 {
                     j = this.ctrlr.insappointment(Convert.ToDateTime(Dateonly).ToString("yyyy-MM-dd"), Convert.ToDateTime(StartT1).ToString("yyyy-MM-dd H:mm:ss"), diff1, txtDescription.Text, patient_id, linkLabel_Name.Text, dr_id, p_mobile, p_email, compoprocedure.Text, name);
                     this.ctrlr.save_log(doctor_id, "Appointment", "logged user adds new appointment", "Add");
                 }
                 if (checkBox1.Checked)
                 {
                     DataTable sms = this.ctrlr.smsdetails();
                     smsdetails(sms);
                     DataTable ptnt = this.ctrlr.Get_Patient_Details(patient_id);
                     Get_Patient_Details(ptnt);
                     DataTable rem = this.ctrlr.smsreminder();
                     smsreminder(rem);
                 }
                 if (checkBox3.Checked)
                 {
                     if (dr_mobile != "0")
                     {
                         string number = "91" + dr_mobile;
                         string type   = "LNG";
                         text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + patient_name + " for " + compoprocedure.Text + " at " + clinicn + "," + contact_no;
                         string smsdctr = this.ctrlr.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 " + patient_name + " for " + compoprocedure.Text + " at " + clinicn + "," + contact_no;
                                 string smsdctr2 = this.ctrlr.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT1.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 " + patient_name + " for " + compoprocedure.Text + " at " + clinicn + "," + contact_no;
                                 string smsdctr3 = this.ctrlr.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT1.ToString("dd/MM/yyyy") + before_time, DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                             }
                         }
                     }
                 }//Doctor SMS End
                 if (checkBox2.Checked)
                 {
                     DataTable email = this.ctrlr.send_email();
                     send_email(email);
                 }// email end
                 if (checkBox4.Checked) // Doctor Email
                 {
                     if (dr_email != "")
                     {
                         DataTable email = this.ctrlr.send_email();
                         send_email(email);
                     }
                 }// Doctor Email end
                 if (j > 0)
                 {
                     var form2 = new PappyjoeMVC.View.Show_Appointment();
                     form2.patient_id = patient_id;
                     form2.doctor_id  = doctor_id;
                     form2.Closed    += (sender1, args) => this.Close();
                     this.Hide();
                     form2.Show();
                 }
                 else
                 {
                     MessageBox.Show("Inseration Failed!..", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Appointment Time is incorrect,Please change the time", "Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch (Exception ex)
     { MessageBox.Show(ex.Message, "Error !..", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }
示例#10
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);
            }
        }
示例#11
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();
        }