示例#1
0
    protected void ASPxScheduler1_AppointmentsChanged(object sender, PersistentObjectsEventArgs e)
    {
        //Delete Schedule

        DevExpress.XtraScheduler.Internal.Implementations.AppointmentInstance AppointmentInstance = (DevExpress.XtraScheduler.Internal.Implementations.AppointmentInstance)e.Objects[0];
        DeleteSchedule objSchedule = new DeleteSchedule();

        objSchedule.Index = 0;
        if (AppointmentInstance.Type == AppointmentType.Normal)
        {
            objSchedule.AppointmentID = Convert.ToInt32(AppointmentInstance.Id);
        }
        else if (AppointmentInstance.Type == AppointmentType.Pattern)
        {
            objSchedule.AppointmentID = Convert.ToInt32(AppointmentInstance.RecurrencePattern.Id);
        }
        switch (AppointmentInstance.Type)
        {
        case AppointmentType.ChangedOccurrence:
            break;

        case AppointmentType.DeletedOccurrence:
        case AppointmentType.Pattern:
            objSchedule.Index = -1;
            billSysDeleteBO.DeleteEventSchedular(objSchedule);
            break;

        case AppointmentType.Normal:
            // billSysDeleteBO.DeleteEventSchedular(objSchedule);
            break;

        case AppointmentType.Occurrence:

            break;

        default:
            break;
        }



        if (AppointmentInstance.Type == AppointmentType.Pattern)
        {
            OccurrenceCalculator      oc    = OccurrenceCalculator.CreateInstance(AppointmentInstance.RecurrenceInfo);
            TimeInterval              ttc   = new TimeInterval(AppointmentInstance.RecurrenceInfo.Start, AppointmentInstance.RecurrenceInfo.End.Add(AppointmentInstance.Duration));
            AppointmentBaseCollection appts = oc.CalcOccurrences(ttc, AppointmentInstance);

            foreach (Appointment item in appts)
            {
                int index = item.RecurrenceIndex;
                #region Data insert to TXN_CALENDAR
                try
                {
                    ArrayList         objAdd;
                    Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender();
                    objAdd = new ArrayList();
                    objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(AppointmentInstance.CustomFields[0].ToString()));
                    objAdd.Add(item.Start);
                    objAdd.Add(item.Start.Hour + "." + item.Start.Minute);
                    objAdd.Add(AppointmentInstance.Description);
                    objAdd.Add(AppointmentInstance.CustomFields[2]);
                    objAdd.Add("TY000000000000000003");
                    objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    objAdd.Add(AppointmentInstance.Start.ToString("tt", CultureInfo.InvariantCulture));
                    int    endMin  = Convert.ToInt32(item.End.Minute);
                    int    endHr   = Convert.ToInt32(item.End.Hour);
                    string endTime = item.End.Hour + "." + item.End.Minute;
                    if (endMin >= 60)
                    {
                        endMin = endMin - 60;
                        endHr  = endHr + 1;
                        if (endHr > 12)
                        {
                            endHr = endHr - 12;
                            if (AppointmentInstance.End.Hour != 12)
                            {
                                if (endTime == "AM")
                                {
                                    endTime = "PM";
                                }
                                else if (endTime == "PM")
                                {
                                    endTime = "AM";
                                }
                            }
                        }
                        else if (endHr == 12)
                        {
                            if (AppointmentInstance.End.Hour != 12)
                            {
                                if (endTime == "AM")
                                {
                                    endTime = "PM";
                                }
                                else if (endTime == "PM")
                                {
                                    endTime = "AM";
                                }
                            }
                        }
                    }
                    objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString());
                    objAdd.Add(item.End.ToString("tt", CultureInfo.InvariantCulture));
                    objAdd.Add(AppointmentInstance.StatusKey);
                    objAdd.Add(item.CustomFields["VISIT_TYPE_ID"]);
                    objAdd.Add(AppointmentInstance.Id);
                    objAdd.Add(index);
                    _bill_Sys_Calender.SaveEventFromSchedular(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                    index++;
                }
                catch (Exception ex)
                {
                    Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                }
                #endregion
            }
            return;
        }
        else if (AppointmentInstance.Type == AppointmentType.Normal)
        {
            string[]          clientData         = AppointmentInstance.Location.Split(new char[] { '-' });
            Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender();
            int index = 0;
            if (clientData[2].Trim() != "null")
            {
                if (_bill_Sys_Calender.CHECKVISIT_FOR_APPOINTMENT(Convert.ToInt32(AppointmentInstance.Id), index, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID))
                {
                    #region Data Update to TXN_CALENDAR
                    try
                    {
                        ArrayList objAdd;

                        objAdd = new ArrayList();
                        objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2]));
                        objAdd.Add(AppointmentInstance.Start);
                        objAdd.Add(AppointmentInstance.Start.Hour + "." + AppointmentInstance.Start.Minute);
                        objAdd.Add(AppointmentInstance.Description);
                        objAdd.Add(clientData[1]);
                        objAdd.Add("TY000000000000000003");
                        objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                        objAdd.Add(AppointmentInstance.Start.ToString("tt", CultureInfo.InvariantCulture));
                        int    endMin  = Convert.ToInt32(AppointmentInstance.End.Minute);
                        int    endHr   = Convert.ToInt32(AppointmentInstance.End.Hour);
                        string endTime = AppointmentInstance.End.Hour + "." + AppointmentInstance.End.Minute;
                        if (endMin >= 60)
                        {
                            endMin = endMin - 60;
                            endHr  = endHr + 1;
                            if (endHr > 12)
                            {
                                endHr = endHr - 12;
                                if (AppointmentInstance.End.Hour != 12)
                                {
                                    if (endTime == "AM")
                                    {
                                        endTime = "PM";
                                    }
                                    else if (endTime == "PM")
                                    {
                                        endTime = "AM";
                                    }
                                }
                            }
                            else if (endHr == 12)
                            {
                                if (AppointmentInstance.End.Hour != 12)
                                {
                                    if (endTime == "AM")
                                    {
                                        endTime = "PM";
                                    }
                                    else if (endTime == "PM")
                                    {
                                        endTime = "AM";
                                    }
                                }
                            }
                        }
                        objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString());
                        objAdd.Add(AppointmentInstance.End.ToString("tt", CultureInfo.InvariantCulture));
                        objAdd.Add(AppointmentInstance.StatusKey);
                        objAdd.Add(clientData[0]);
                        objAdd.Add(AppointmentInstance.Id);
                        objAdd.Add(index);
                        objAdd.Add(AppointmentInstance.Id);
                        _bill_Sys_Calender.UPDATEEventByAppointmentId(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                        index++;
                    }
                    catch (Exception ex)
                    {
                        Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                    }
                    #endregion
                }
                else
                {
                    #region Data insert to TXN_CALENDAR
                    try
                    {
                        ArrayList objAdd;

                        objAdd = new ArrayList();
                        objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2]));
                        objAdd.Add(AppointmentInstance.Start);
                        objAdd.Add(AppointmentInstance.Start.Hour + "." + AppointmentInstance.Start.Minute);
                        objAdd.Add(AppointmentInstance.Description);
                        objAdd.Add(clientData[1]);
                        objAdd.Add("TY000000000000000003");
                        objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                        objAdd.Add(AppointmentInstance.Start.ToString("tt", CultureInfo.InvariantCulture));
                        int    endMin  = Convert.ToInt32(AppointmentInstance.End.Minute);
                        int    endHr   = Convert.ToInt32(AppointmentInstance.End.Hour);
                        string endTime = AppointmentInstance.End.Hour + "." + AppointmentInstance.End.Minute;
                        if (endMin >= 60)
                        {
                            endMin = endMin - 60;
                            endHr  = endHr + 1;
                            if (endHr > 12)
                            {
                                endHr = endHr - 12;
                                if (AppointmentInstance.End.Hour != 12)
                                {
                                    if (endTime == "AM")
                                    {
                                        endTime = "PM";
                                    }
                                    else if (endTime == "PM")
                                    {
                                        endTime = "AM";
                                    }
                                }
                            }
                            else if (endHr == 12)
                            {
                                if (AppointmentInstance.End.Hour != 12)
                                {
                                    if (endTime == "AM")
                                    {
                                        endTime = "PM";
                                    }
                                    else if (endTime == "PM")
                                    {
                                        endTime = "AM";
                                    }
                                }
                            }
                        }
                        objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString());
                        objAdd.Add(AppointmentInstance.End.ToString("tt", CultureInfo.InvariantCulture));
                        objAdd.Add(0);
                        objAdd.Add(clientData[0]);
                        objAdd.Add(AppointmentInstance.Id);
                        objAdd.Add(index);
                        _bill_Sys_Calender.SaveEventFromSchedular(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                    }
                    catch (Exception ex)
                    {
                        Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                    }
                    #endregion
                }
            }
        }
        else if (AppointmentInstance.Type == AppointmentType.DeletedOccurrence)
        {
            //Deleted code in TXN_CALENDER_EVENTS
            //DeleteSchedule objSchedule = new DeleteSchedule();
            //objSchedule.Index = apt.RecurrenceIndex;
            //objSchedule.AppointmentID = Convert.ToInt32(apt.RecurrencePattern.Id);
            //billSysDeleteBO.DeleteEventSchedular(objSchedule);
            //return;
        }
        else if (AppointmentInstance.Type == AppointmentType.ChangedOccurrence)
        {
            string[] clientData = AppointmentInstance.Location.Split(new char[] { '-' });

            int index = AppointmentInstance.RecurrenceIndex;
            #region Data Update to TXN_CALENDAR
            try
            {
                ArrayList         objAdd;
                Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender();
                objAdd = new ArrayList();
                objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2]));
                objAdd.Add(AppointmentInstance.Start);
                objAdd.Add(AppointmentInstance.Start.Hour + "." + AppointmentInstance.Start.Minute);
                objAdd.Add(AppointmentInstance.Description);
                objAdd.Add(clientData[1]);
                objAdd.Add("TY000000000000000003");
                objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                objAdd.Add(AppointmentInstance.Start.ToString("tt", CultureInfo.InvariantCulture));
                int    endMin  = Convert.ToInt32(AppointmentInstance.End.Minute);
                int    endHr   = Convert.ToInt32(AppointmentInstance.End.Hour);
                string endTime = AppointmentInstance.End.Hour + "." + AppointmentInstance.End.Minute;
                if (endMin >= 60)
                {
                    endMin = endMin - 60;
                    endHr  = endHr + 1;
                    if (endHr > 12)
                    {
                        endHr = endHr - 12;
                        if (AppointmentInstance.End.Hour != 12)
                        {
                            if (endTime == "AM")
                            {
                                endTime = "PM";
                            }
                            else if (endTime == "PM")
                            {
                                endTime = "AM";
                            }
                        }
                    }
                    else if (endHr == 12)
                    {
                        if (AppointmentInstance.End.Hour != 12)
                        {
                            if (endTime == "AM")
                            {
                                endTime = "PM";
                            }
                            else if (endTime == "PM")
                            {
                                endTime = "AM";
                            }
                        }
                    }
                }
                objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString());
                objAdd.Add(AppointmentInstance.End.ToString("tt", CultureInfo.InvariantCulture));
                objAdd.Add(AppointmentInstance.StatusKey);
                objAdd.Add(clientData[0]);
                objAdd.Add(AppointmentInstance.RecurrencePattern.Id);
                objAdd.Add(index);
                objAdd.Add(AppointmentInstance.Id);
                _bill_Sys_Calender.UPDATEEventByAppointmentId(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                index++;
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            }
            #endregion
        }
    }
示例#2
0
    protected void ASPxScheduler1_AppointmentsInserted(object sender, DevExpress.XtraScheduler.PersistentObjectsEventArgs e)
    {
        //Task.Factory.StartNew(() =>
        //{
        Appointment apt = (Appointment)e.Objects[0];

        string[] clientData = apt.Location.Split(new char[] { '-' });
        if (clientData[2].Trim() != "null")
        {
            if (apt.Type == AppointmentType.Pattern)
            {
                OccurrenceCalculator      oc    = OccurrenceCalculator.CreateInstance(apt.RecurrenceInfo);
                TimeInterval              ttc   = new TimeInterval(apt.RecurrenceInfo.Start, apt.RecurrenceInfo.End.Add(apt.Duration));
                AppointmentBaseCollection appts = oc.CalcOccurrences(ttc, apt);

                foreach (Appointment item in appts)
                {
                    int index = item.RecurrenceIndex;
                    #region Data insert to TXN_CALENDAR
                    try
                    {
                        ArrayList         objAdd;
                        Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender();
                        objAdd = new ArrayList();
                        objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2]));
                        objAdd.Add(item.Start);
                        objAdd.Add(item.Start.Hour + "." + item.Start.Minute);
                        objAdd.Add(apt.Description);
                        objAdd.Add(clientData[1]);
                        objAdd.Add("TY000000000000000003");
                        objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                        objAdd.Add(apt.Start.ToString("tt", CultureInfo.InvariantCulture));
                        int    endMin  = Convert.ToInt32(item.End.Minute);
                        int    endHr   = Convert.ToInt32(item.End.Hour);
                        string endTime = item.End.Hour + "." + item.End.Minute;
                        if (endMin >= 60)
                        {
                            endMin = endMin - 60;
                            endHr  = endHr + 1;
                            if (endHr > 12)
                            {
                                endHr = endHr - 12;
                                if (apt.End.Hour != 12)
                                {
                                    if (endTime == "AM")
                                    {
                                        endTime = "PM";
                                    }
                                    else if (endTime == "PM")
                                    {
                                        endTime = "AM";
                                    }
                                }
                            }
                            else if (endHr == 12)
                            {
                                if (apt.End.Hour != 12)
                                {
                                    if (endTime == "AM")
                                    {
                                        endTime = "PM";
                                    }
                                    else if (endTime == "PM")
                                    {
                                        endTime = "AM";
                                    }
                                }
                            }
                        }
                        objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString());
                        objAdd.Add(item.End.ToString("tt", CultureInfo.InvariantCulture));
                        objAdd.Add(apt.StatusId);
                        objAdd.Add(clientData[0]);
                        objAdd.Add(apt.Id);
                        objAdd.Add(index);
                        _bill_Sys_Calender.SaveEventFromSchedular(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                        index++;
                    }
                    catch (Exception ex)
                    {
                        Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                    }
                    #endregion
                }
                return;
            }
            else if (apt.Type == AppointmentType.Normal)
            {
                #region Data insert to TXN_CALENDAR
                try
                {
                    ArrayList         objAdd;
                    Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender();
                    objAdd = new ArrayList();
                    objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2]));
                    objAdd.Add(apt.Start);
                    objAdd.Add(apt.Start.Hour + "." + apt.Start.Minute);
                    objAdd.Add(apt.Description);
                    objAdd.Add(clientData[1]);
                    objAdd.Add("TY000000000000000003");
                    objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    objAdd.Add(apt.Start.ToString("tt", CultureInfo.InvariantCulture));
                    int    endMin  = Convert.ToInt32(apt.End.Minute);
                    int    endHr   = Convert.ToInt32(apt.End.Hour);
                    string endTime = apt.End.Hour + "." + apt.End.Minute;
                    if (endMin >= 60)
                    {
                        endMin = endMin - 60;
                        endHr  = endHr + 1;
                        if (endHr > 12)
                        {
                            endHr = endHr - 12;
                            if (apt.End.Hour != 12)
                            {
                                if (endTime == "AM")
                                {
                                    endTime = "PM";
                                }
                                else if (endTime == "PM")
                                {
                                    endTime = "AM";
                                }
                            }
                        }
                        else if (endHr == 12)
                        {
                            if (apt.End.Hour != 12)
                            {
                                if (endTime == "AM")
                                {
                                    endTime = "PM";
                                }
                                else if (endTime == "PM")
                                {
                                    endTime = "AM";
                                }
                            }
                        }
                    }
                    objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString());
                    objAdd.Add(apt.End.ToString("tt", CultureInfo.InvariantCulture));
                    objAdd.Add(0);
                    objAdd.Add(clientData[0]);
                    objAdd.Add(apt.Id);
                    objAdd.Add(0);
                    _bill_Sys_Calender.SaveEventFromSchedular(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString());
                }
                catch (Exception ex)
                {
                    Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                }
                #endregion
                return;
            }
            else if (apt.Type == AppointmentType.DeletedOccurrence)
            {
                //Deleted code in TXN_CALENDER_EVENTS
                DeleteSchedule objSchedule = new DeleteSchedule();
                objSchedule.Index         = apt.RecurrenceIndex;
                objSchedule.AppointmentID = Convert.ToInt32(apt.RecurrencePattern.Id);
                billSysDeleteBO.DeleteEventSchedular(objSchedule);
                return;
            }
            else if (apt.Type == AppointmentType.ChangedOccurrence)
            {
                return;
            }
        }
    }