Category ดำรงตำแหน่ง รักษาราชการ
 public virtual void Update(RadScheduler owner, Appointment appointmentToUpdate)
 {
     if (!PersistChanges)
     {
         return;
     }
 }
Exemple #2
0
    protected void Appointments_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        currentAppointment = (Appointment)e.Item.DataItem;
        if (currentAppointment == null)
            return;

        ImageButton btnDel = (ImageButton)e.Item.FindControl("ButtonDelete");
        btnDel.CommandArgument = currentAppointment.Id.ToString();
        btnDel.Attributes["OwnerId"] = LoginState.IsAdmin() ? "admin" : currentAppointment.UserId;

        Repeater inner = (Repeater)e.Item.FindControl("Posts");
        List<Post> posts = new List<Post>();
        foreach (Post p in currentAppointment.AppointmentPosts)
            posts.Add(p);
        posts.Sort((a, b) => a.PostingDate.CompareTo(b.PostingDate));
        inner.DataSource = posts;
        inner.ItemDataBound += new RepeaterItemEventHandler(inner_ItemDataBound);
        inner.DataBind();
        TextBox txt = (TextBox)e.Item.FindControl("Name");
        Button btn = (Button)e.Item.FindControl("ButtonSend");
        btn.CommandArgument = currentAppointment.Id.ToString();
        btn.OnClientClick = string.Format("onSendPost('{0}');", txt.ClientID);
        HtmlImage img = (HtmlImage)e.Item.FindControl("Meteo");
        int idx = currentAppointment.AppointmentDate.DayOfYear - DateTime.Now.DayOfYear;
        if (idx < 0 || idx > 6)
            img.Visible = false;
        else
            img.Src = string.Format("http://www.ilmeteo.it/cartine2/{0}.LIG.png", idx);
    }
    public override void Delete(ISchedulerInfo shedulerInfo, Appointment appointmentToDelete)
    {
        if (!PersistChanges)
        {
            return;
        }

        using (DbConnection conn = OpenConnection())
        {
            DbCommand cmd = DbFactory.CreateCommand();
            cmd.Connection = conn;

            using (DbTransaction tran = conn.BeginTransaction())
            {
                cmd.Transaction = tran;

                ClearClassStudents(appointmentToDelete.ID, cmd);

                cmd.Parameters.Clear();
                cmd.Parameters.Add(CreateParameter("@ClassID", appointmentToDelete.ID));
                cmd.CommandText = "DELETE FROM [DbProvider_Classes] WHERE [ClassID] = @ClassID";
                cmd.ExecuteNonQuery();

                tran.Commit();
            }
        }
    }
        private async void AddToCalendar(Activity tempActivity)
        {
            Appointment appointment = new Appointment();
            //Activity tempActivity = LoadActivityValuesFromControls();

            appointment.Subject = tempActivity.Title;
            appointment.Details = tempActivity.Description;
            appointment.Location = tempActivity.ContextUI;
            appointment.Reminder = TimeSpan.FromHours(1);
            appointment.StartTime = ((DateTimeOffset)tempActivity.StartDate).Date;
            string activityAppointmentId = string.Empty; // to powinno być pole aktywności activity.AppointmentId

            if (tempActivity.StartHour != null)
                appointment.StartTime += (TimeSpan)tempActivity.StartHour;

            if (tempActivity.EstimationId != null)
                appointment.Duration = TimeSpan.FromHours(LocalDatabaseHelper.ReadItem<Estimation>((int)tempActivity.EstimationId).Duration);

            var rect = new Rect(new Point(Window.Current.Bounds.Width / 2, Window.Current.Bounds.Height / 2), new Size());

            string newAppointmentId;

            if (string.IsNullOrEmpty(activityAppointmentId))
            {
                newAppointmentId = await AppointmentManager.ShowReplaceAppointmentAsync(activityAppointmentId, appointment, rect, Placement.Default);

                if (string.IsNullOrEmpty(newAppointmentId))
                    newAppointmentId = activityAppointmentId;
            }
            else
                newAppointmentId = await AppointmentManager.ShowAddAppointmentAsync(appointment, rect, Placement.Default);

            LocalDatabaseHelper.ExecuteQuery("UPDATE Activity SET AppointmentId = '" + newAppointmentId + "' WHERE Id = " + tempActivity.Id);
            App.PlannedWeekNeedsToBeReloaded = true;
        }
 public Data(ContactInformation contactInformation, string patientDoctor, Appointment appointment, Insurance insure)
 {
     this.contactInformation = contactInformation;
     this.doctor = patientDoctor;
     this.appointment = appointment;
     this.insurance = insure;
 }
 public void AppDefaultConstructorDesc()
 {
     // Arrange and Act
     Appointment testApp = new Appointment();
     // Assert
     Assert.AreEqual("Description: \nLocation: ", testApp.DisplayableDescription, "The appointment does not give a default description of \"\"! It should!");
 }
Exemple #7
0
        public ViewModel()
        {
            this.appointments = new ObservableCollection<Appointment>();

            var app = new Appointment { Start = DateTime.Today.AddHours(8), End = DateTime.Today.AddHours(9), Subject = "Scrum meeting" };
            this.appointments.Add(app);
        }
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new MSPAccountingContext())
            {
                var appointment = new Appointment();

                appointment.Date = Convert.ToDateTime(dtpDate.Value);
                appointment.Location = txtbxLocation.Text;

                var errors = appointment.GetModelErrors();
                if (errors.Count > 0)
                {
                    new ErrorDisplay(errors).Show();
                }
                else
                {
                    db.Appointment.Add(appointment);
                    db.SaveChanges();

                    MessageBox.Show("Appointment Successfully Created!", "Success", MessageBoxButton.OK);

                    this.Close();
                }
            }
        }
        public void InsertVolunteerAvailability(ISchedulerInfo shedulerInfo, Appointment appointmentToInsert, sp_Availablity_DM cAvail)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                try
                {
                    var cVolAvail = new tblAvailability
                    {
                        VolID = cAvail.VolID,
                        AddrID = cAvail.AddrID,
                        AvailStart = appointmentToInsert.Start,
                        AvailEnd = appointmentToInsert.End,
                        Description = appointmentToInsert.Description,
                        RecurrenceParentID = (int?)(appointmentToInsert.RecurrenceParentID),
                        RecurrenceRule = appointmentToInsert.RecurrenceRule,
                        Subject = appointmentToInsert.Subject
                    };
                    context.tblAvailabilities.Add(cVolAvail);
                    context.SaveChanges();
                }
                catch (Exception ex)
                {
                }

            }
        }
 public async void Add(object sender, DatePicker startDate, TimePicker startTime,
     TextBox subject, TextBox location, TextBox details, ComboBox duration, CheckBox allDay)
 {
     FrameworkElement element = (FrameworkElement)sender;
     GeneralTransform transform = element.TransformToVisual(null);
     Point point = transform.TransformPoint(new Point());
     Rect rect = new Rect(point, new Size(element.ActualWidth, element.ActualHeight));
     DateTimeOffset date = startDate.Date;
     TimeSpan time = startTime.Time;
     int minutes = int.Parse((string)((ComboBoxItem)duration.SelectedItem).Tag);
     Appointment appointment = new Appointment()
     {
         StartTime = new DateTimeOffset(date.Year, date.Month, date.Day,
         time.Hours, time.Minutes, 0, TimeZoneInfo.Local.GetUtcOffset(DateTime.Now)),
         Subject = subject.Text,
         Location = location.Text,
         Details = details.Text,
         Duration = TimeSpan.FromMinutes(minutes),
         AllDay = (bool)allDay.IsChecked
     };
     string id = await AppointmentManager.ShowAddAppointmentAsync(appointment, rect, Placement.Default);
     if (string.IsNullOrEmpty(id))
     {
         Show("Appointment not Added", "Appointment App");
     }
     else
     {
         Show(string.Format("Appointment {0} Added", id), "Appointment App");
     }
 }
        private Appointment GetAppointmentData()
        {
            Appointment patientAppointment = new Appointment
                                                 {ScheduledTimeStamp = DateTime.Now.AddDays(3), IsRecurrence = false};

            return patientAppointment;
        }
Exemple #12
0
		public ViewModel()
		{
			DateTime today = DateTime.Now;

			this.CustomersSource = new ObservableCollection<Customer> 
			{
				new Customer { ID = 1, Name = "Customer 1" },
				new Customer { ID = 2, Name = "Customer 2" },
				new Customer { ID = 3, Name = "Customer 3" },
				new Customer { ID = 4, Name = "Customer 4" },
				new Customer { ID = 5, Name = "Customer 5" } 
			};
			Appointment app1 = new Appointment { Start = today, End = today.AddHours(1), Subject = "Appointment 1" };
			app1.Resources.Add(new Resource("Mary Baird", "Person"));
			Appointment app2 = new Appointment { Start = today.AddHours(1.5), End = today.AddHours(2.5), Subject = "Appointment 2" };
			app2.Resources.Add(new Resource("Diego Roel", "Person"));
			Appointment app3 = new Appointment { Start = today.AddHours(1.5), End = today.AddHours(2.5), Subject = "Appointment 3" };
			app3.Resources.Add(new Resource("Mary Baird", "Person"));
			this.AppointmentsSource = new ObservableCollection<Appointment> 
			{ 
				app1,
				app2,
				app3
			};
		}
        public static void Run()
        {
            try
            {

                // ExStart:CreateMeetingRequestWithRecurrence
                String szUniqueId;

                // Create a mail message
                MailMessage msg1 = new MailMessage();
                msg1.To.Add("*****@*****.**");
                msg1.From = new MailAddress("*****@*****.**");

                // Create appointment object
                Appointment agendaAppointment = default(Appointment);
             
                // Fill appointment object
                System.DateTime StartDate = new DateTime(2013, 12, 1, 17, 0, 0);
                System.DateTime EndDate = new DateTime(2013, 12, 31, 17, 30, 0);
                agendaAppointment = new Appointment("same place", StartDate, EndDate, msg1.From, msg1.To);

                // Create unique id as it will help to access this appointment later
                szUniqueId = Guid.NewGuid().ToString();
                agendaAppointment.UniqueId = szUniqueId;
                agendaAppointment.Description = "----------------";

                // Create a weekly reccurence pattern object
                Aspose.Email.Recurrences.WeeklyRecurrencePattern pattern1 = new WeeklyRecurrencePattern(14);

                // Set weekly pattern properties like days: Mon, Tue and Thu
                pattern1.StartDays = new CalendarDay[3];
                pattern1.StartDays[0] = CalendarDay.Monday;
                pattern1.StartDays[1] = CalendarDay.Tuesday;
                pattern1.StartDays[2] =CalendarDay.Thursday;
                pattern1.Interval = 1;

                // Set recurrence pattern for the appointment
                agendaAppointment.Recurrence = pattern1;

                //Attach this appointment with mail
                msg1.AlternateViews.Add(agendaAppointment.RequestApointment());

                // Create SmtpCleint
                SmtpClient client = new SmtpClient("smtp.gmail.com", 587, "*****@*****.**", "your.password");
                client.SecurityOptions = SecurityOptions.Auto;

                // Send mail with appointment request
                client.Send(msg1);

                // Return unique id for later usage
                // return szUniqueId;
                // ExEnd:SendMailUsingDNS
            }
            catch (Exception exception)
            {
                Console.Write(exception.Message);
                throw;
            }

        }
Exemple #14
0
		public ViewModel()
		{
            var date = CalendarHelper.GetFirstDayOfWeek(DateTime.Today, DayOfWeek.Monday);

            var meetingApp = new Appointment()
            {
                Subject = "Meeting with John",
                Start = date.AddHours(7),
                End = date.AddHours(8)
            };
            meetingApp.Resources.Add(new Resource("Room 1", "Room"));

            var scrumApp = new Appointment()
            {
                Subject = "Morning Scrum",
                Start = date.AddHours(9),
                End = date.AddHours(9).AddMinutes(30)
            };
            scrumApp.Resources.Add(new Resource("Room 1", "Room"));
            scrumApp.RecurrenceRule = new RecurrenceRule(
                         new RecurrencePattern()
                {
                    Frequency = RecurrenceFrequency.Daily,
                    MaxOccurrences=5
                }
            );             
			Appointments = new ObservableCollection<Appointment>() { scrumApp, meetingApp };
            this.SelectedAppointment = meetingApp;
		}
        public static void Run()
        {
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_SMTP();
            string dstEmail = dataDir + "outputAttachments.msg";

            // Create an instance of the MailMessage class
            MailMessage msg = new MailMessage();

            // Set the sender, recipient, who will receive the meeting request. Basically, the recipient is the same as the meeting attendees
            msg.From = "*****@*****.**";
            msg.To = "[email protected], [email protected], [email protected], [email protected]";

            // Create Appointment instance
            Appointment app = new Appointment("Room 112", new DateTime(2015, 7, 17, 13, 0, 0), new DateTime(2015, 7, 17, 14, 0, 0), msg.From, msg.To);
            app.Summary = "Release Meetting";
            app.Description = "Discuss for the next release";

            // Add appointment to the message and Create an instance of SmtpClient class
            msg.AddAlternateView(app.RequestApointment());
            SmtpClient client = GetSmtpClient();

            try
            {
                // Client.Send will send this message
                client.Send(msg);
                Console.WriteLine("Message sent");
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
            }
            Console.WriteLine(Environment.NewLine + "Meeting request send successfully.");
        }
        public CustomAppointmentServicePlan(ServicePlan sp, SchedulerControl control, Appointment apt, List<OSYS.Controls.ServicePlan.ServicePlanPersonelSurrogate> list, string roomNumber, string guestID, string guestNote,
            DateTime startDateTime, string therapyName, Guid? therapyID, string guestName, string servicePlanID)
        {
            InitializeComponent();
            if (control == null || apt == null)
                throw new ArgumentNullException("control");
            if (control == null || apt == null)
                throw new ArgumentNullException("apt");

            ServisPlanClass = sp;

            RoomNumber = roomNumber;
            GuestID = guestID;
            GuestNote = guestNote;
            personelList = list;
            StartDateTime = startDateTime;

            cbPersonelList.Clear();
            cbPersonelList.ItemsSource = list;
            cbPersonelList.DisplayMember = "Adi";
            cbPersonelList.ValueMember = "PersonelID";

            TherapyName = therapyName;
            TherapyID = therapyID;
            GuestName = guestName;
            ServicePlanID = servicePlanID;
        }
Exemple #17
0
 public void ShowDetails(Appointment currentAppointment)
 {
     var eventEditor = container.Resolve<EventEditorViewModel>();
     eventEditor.Edit(currentAppointment);
     container.Resolve<IWindowManager>().ShowModal(eventEditor);
     BuildupTimeLine();
 }
        public static string Format(Appointment appointment)
        {
            if (appointment == null) throw new ArgumentNullException(nameof(appointment));

            var today = DateTime.Today;
            var startTime = appointment.StartTime;
            var startDate = appointment.StartTime.Date;
            var endTime = startTime.Add(appointment.Duration);
            var endDate = endTime.AddTicks(-1).Date;

            var allDay = appointment.AllDay;
            var endsSameDay = endDate == startTime.Date;
            var startedBeforeToday = startDate < today;
            var startsToday = startDate == today;
            var startsTomorrow = startDate == today.AddDays(1);
            var startsThisWeek = !startedBeforeToday && startDate < today.AddDays(7);
            var startedYesterday = startDate == today.AddDays(-1);
            var startedLastWeek = startedBeforeToday && startDate > today.AddDays(-7);
            var endsToday = endDate == today;
            var endsTomorrow = endDate == today.AddDays(1);
            var endsThisWeek = endDate < today.AddDays(7);
            
            string format;
            if (FormatDecisionMatrix.TryDecide(out format, allDay, endsSameDay, startedBeforeToday, startsToday, startsTomorrow, startsThisWeek, startedYesterday, startedLastWeek, endsToday, endsTomorrow, endsThisWeek))
            {
                return String.Format(format, allDay ? startDate : startTime, allDay ? endDate : endTime);
            }

            return null;
        }
        public static void Run()
        {
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_Outlook();

            string[] files = new string[3];
            files[0] = dataDir + "attachment_1.doc";
            files[1] = dataDir + "download.png";
            files[2] = dataDir + "Desert.jpg";

            Appointment app1 = new Appointment("Home", DateTime.Now.AddHours(1), DateTime.Now.AddHours(1), "*****@*****.**", "*****@*****.**");
            foreach (string file in files)
            {
                using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(file)))
                {
                    app1.Attachments.Add(new Attachment(ms, Path.GetFileName(file)));
                }
            }

            app1.Save(dataDir + "appWithAttachments_out.ics", AppointmentSaveFormat.Ics);

            Appointment app2 = Appointment.Load(dataDir + "appWithAttachments_out.ics");
            Console.WriteLine(app2.Attachments.Count);
            foreach (Attachment att in app2.Attachments)
                Console.WriteLine(att.Name);
            
        }
        public async static Task<string> Add(Appointment appt, Rect selection)
        {
            var id = await AppointmentManager.ShowAddAppointmentAsync(appt, selection, Placement.Default);
            AddAppointmentId(id);

            return id;
        }
Exemple #21
0
        static void Main(string[] args)
        {
            // Create attendees of the meeting
            MailAddressCollection attendees = new MailAddressCollection();
            attendees.Add("*****@*****.**");
            attendees.Add("*****@*****.**");

            // Set up appointment
            Appointment app = new Appointment(
                "Location", // location of meeting
                DateTime.Now, // start date
                DateTime.Now.AddHours(1), // end date
                new MailAddress("*****@*****.**"), // organizer
                attendees); // attendees

            // Set up message that needs to be sent
            MailMessage msg = new MailMessage();
            msg.From = "*****@*****.**";
            msg.To = "*****@*****.**";
            msg.Subject = "appointment request";
            msg.Body = "you are invited";

            // Add meeting request to the message
            msg.AddAlternateView(app.RequestApointment());

            // Set up the SMTP client to send email with meeting request
            SmtpClient client = new SmtpClient("host", 25, "user", "password");
            client.Send(msg);
        }
        public CustomAppointmentForm(SchedulerControl control, Appointment apt, Event ev)
        {
            Event = ev;
            InitializeComponent();

            Controller = new EventAppointmentFormController(control, apt);
        }
 public void AppDefaultConstructorLength()
 {
     // Arrange and Act
     Appointment testApp = new Appointment();
     // Assert
     Assert.AreEqual(30, testApp.Length, "The appointment does not give a default length of 30! It should!");
 }
Exemple #24
0
 ///<summary>Inserts one Appointment into the database.  Returns the new priKey.</summary>
 internal static long Insert(Appointment appointment)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         appointment.AptNum=DbHelper.GetNextOracleKey("appointment","AptNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(appointment,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     appointment.AptNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(appointment,false);
     }
 }
 //this function is going to management the calendar whick means you can defination your own calendar style
 private async void Button_Click(object sender, RoutedEventArgs e)
 {
     //await AppointmentManager.ShowTimeFrameAsync(DateTimeOffset.Now, TimeSpan.FromHours(1));
     Appointment ap = new Appointment();
     ap.Subject = "this is a new appointment";
     ap.StartTime = System.DateTime.Now;
     await AppointmentManager.ShowAddAppointmentAsync(ap, new Rect());
 }
        public void DeleteAppointment(Appointment appointment)
        {
            if (appointment == null)
                throw new ArgumentNullException("appointment");

            allTimeList.Remove(appointment);
            Task.Factory.StartNew(Serialize);
        }
 public void Update(Appointment appointment)
 {
     if (_db.Any(x => x.Id == appointment.Id))
     {
         _db.Remove(FindById(appointment.Id));
         _db.Add(appointment);
     }
 }
        public void SetUp()
        {
            DomainEvents.ClearCallbacks();

            testAppointment1 = Appointment.Create(testScheduleId,
                testClientId, testPatientId, testRoomId, testStartTime, testEndTime,
                testAppointmentTypeId, testDoctorId, "testAppointment1");
        }
        public override void Insert(ISchedulerInfo shedulerInfo, Appointment appointmentToInsert)
        {
            sp_Availablity_DM cAvail = new sp_Availablity_DM();

            cAvail.VolID = new Guid(appointmentToInsert.Attributes["VolID"]);
            cAvail.AddrID = Convert.ToInt32(appointmentToInsert.Attributes["AddrID"]);

            DAL.InsertVolunteerAvailability(shedulerInfo, appointmentToInsert, cAvail);
        }
        public async void ExportToCalendar(object item)
        {
            var animeItemViewModel = item as AnimeItemViewModel;
            DayOfWeek day = Utilities.StringToDay(animeItemViewModel.TopLeftInfoBind);
            var date = GetNextWeekday(DateTime.Today, day);

            var timeZoneOffset = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now);
            var startTime = new DateTimeOffset(date.Year, date.Month, date.Day, 0, 0, 0, timeZoneOffset);

            var appointment = new Appointment();

            appointment.StartTime = startTime;
            appointment.Subject = "Anime - " + animeItemViewModel.Title;
            appointment.AllDay = true;

            var recurrence = new AppointmentRecurrence();
            recurrence.Unit = AppointmentRecurrenceUnit.Weekly;
            recurrence.Interval = 1;
            recurrence.DaysOfWeek = UWPUtilities.DayToAppointementDay(day);
            if (animeItemViewModel.EndDate != AnimeItemViewModel.InvalidStartEndDate)
            {
                var endDate = DateTime.Parse(animeItemViewModel.EndDate);
                recurrence.Until = endDate;
            }
            else if (animeItemViewModel.StartDate != AnimeItemViewModel.InvalidStartEndDate &&
                     animeItemViewModel.AllEpisodes != 0)
            {
                var weeksPassed = (DateTime.Today - DateTime.Parse(animeItemViewModel.StartDate)).Days / 7;
                if (weeksPassed < 0)
                    return;
                var weeks = (uint)(animeItemViewModel.AllEpisodes - weeksPassed);
                recurrence.Until = DateTime.Today.Add(TimeSpan.FromDays(weeks * 7));
            }
            else if (animeItemViewModel.AllEpisodes != 0)
            {
                var epsLeft = animeItemViewModel.AllEpisodes - animeItemViewModel.MyEpisodes;
                recurrence.Until = DateTime.Today.Add(TimeSpan.FromDays(epsLeft * 7));
            }
            else
            {
                var msg = new MessageDialog("Not enough data to create event.");
                await msg.ShowAsync();
                return;
            }
            appointment.Recurrence = recurrence;
            var rect = new Rect(new Point(Window.Current.Bounds.Width / 2, Window.Current.Bounds.Height / 2), new Size());
            try
            {
                await AppointmentManager.ShowAddAppointmentAsync(appointment, rect, Placement.Default);
            }
            catch (Exception)
            {
                //appointpent is already being created
            }

        }
 public bool PutUpdateAppointment([FromBody] Appointment appointment)
 {
     return(repository.UpdateAppointment(appointment));
 }
 public void SetUp()
 {
     _testClass = new Appointment();
 }
#pragma warning disable 1998
        public async Task Handle(AppointmentCreatedInOutlook message)
        {
            try
            {
                Appointment Appo = sqlController.AppointmentsFind(message.Appo.GlobalId);

                if (Appo.ProcessingState == ProcessingStateOptions.Processed.ToString())
                {
                    bool sqlUpdate = sqlController.AppointmentsUpdate(Appo.GlobalId, ProcessingStateOptions.Created, Appo.Body, "", "", Appo.Completed, Appo.Start, Appo.End, Appo.Duration);
                    if (sqlUpdate)
                    {
                        bool updateStatus = outlookOnlineController.CalendarItemUpdate(Appo.GlobalId, (DateTime)Appo.Start, ProcessingStateOptions.Created, Appo.Body);
                    }
                    else
                    {
                        throw new Exception("Unable to update Appointment in AppointmentCreatedInOutlookHandler");
                    }
                    //log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() L623");
                }

                eFormData.MainElement mainElement = sdkCore.TemplateRead((int)Appo.TemplateId);
                if (mainElement == null)
                {
                    log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() L625 mainElement is NULL!!!");
                }

                mainElement.Repeated = 1;
                DateTime startDt = new DateTime(Appo.Start.Year, Appo.Start.Month, Appo.Start.Day, 0, 0, 0);
                DateTime endDt   = new DateTime(Appo.End.AddDays(1).Year, Appo.End.AddDays(1).Month, Appo.End.AddDays(1).Day, 23, 59, 59);
                //mainElement.StartDate = ((DateTime)appo.Start).ToUniversalTime();
                mainElement.StartDate = startDt;
                //mainElement.EndDate = ((DateTime)appo.End.AddDays(1)).ToUniversalTime();
                mainElement.EndDate = endDt;
                //log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() L629");

                #region fill eForm
                if (Appo.AppointmentPrefillFieldValues.Count > 0)
                {
                    SetDefaultValue(mainElement.ElementList, Appo.AppointmentPrefillFieldValues);
                    string description = "";
                    foreach (AppointmentPrefillFieldValue pfv in Appo.AppointmentPrefillFieldValues)
                    {
                        eFormData.Field field      = sdkCore.Advanced_FieldRead(pfv.FieldId);
                        string          fieldValue = pfv.FieldValue;
                        if (field.FieldType == eFormShared.Constants.FieldTypes.EntitySelect)
                        {
                            fieldValue = sdkCore.EntityItemReadByMicrotingUUID(pfv.FieldValue).Name;
                        }
                        description = description + "<b>" + field.Label + ":</b> " + fieldValue + "<br>";
                    }
                    eFormShared.CDataValue cDataValue = new eFormShared.CDataValue();
                    cDataValue.InderValue = description;
                    mainElement.ElementList[0].Description = cDataValue;
                }
                #endregion


                log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() StartDate is " + mainElement.StartDate);
                log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() EndDate is " + mainElement.EndDate);
                bool allGood = false;
                List <AppoinntmentSite> appoSites = Appo.AppointmentSites;
                if (appoSites == null)
                {
                    log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() L635 appoSites is NULL!!! for appo.GlobalId" + Appo.GlobalId);
                }
                else
                {
                    foreach (AppoinntmentSite appo_site in appoSites)
                    {
                        log.LogEverything("Not Specified", "outlookController.foreach AppoinntmentSite appo_site is : " + appo_site.MicrotingSiteUid);
                        string resultId;
                        if (appo_site.MicrotingUuId == null)
                        {
                            resultId = sdkCore.CaseCreate(mainElement, "", appo_site.MicrotingSiteUid);
                            log.LogEverything("Not Specified", "outlookController.foreach resultId is : " + resultId);
                        }
                        else
                        {
                            resultId = appo_site.MicrotingUuId;
                        }

                        if (!string.IsNullOrEmpty(resultId))
                        {
                            int localCaseId = (int)sdkCore.CaseLookupMUId(resultId).CaseId;
                            //appo_site.MicrotingUuId = resultId;
                            sqlController.AppointmentSiteUpdate((int)appo_site.Id, localCaseId.ToString(), ProcessingStateOptions.Sent);
                            allGood = true;
                        }
                        else
                        {
                            log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() L656");
                            allGood = false;
                        }
                    }

                    if (allGood)
                    {
                        //log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() L663");
                        bool updateStatus = outlookOnlineController.CalendarItemUpdate(Appo.GlobalId, (DateTime)Appo.Start, ProcessingStateOptions.Sent, Appo.Body);
                        if (updateStatus)
                        {
                            //log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() L667");
                            sqlController.AppointmentsUpdate(Appo.GlobalId, ProcessingStateOptions.Sent, Appo.Body, "", "", Appo.Completed, Appo.Start, Appo.End, Appo.Duration);
                        }
                    }
                    else
                    {
                        //log.LogEverything("Not Specified", "outlookController.SyncAppointmentsToSdk() L673");
                        //syncAppointmentsToSdkRunning = false;
                    }
                }
                //}
            }
            catch (Exception ex)
            {
                log.LogEverything("Exception", "Got the following exception : " + ex.Message + " and stacktrace is : " + ex.StackTrace);
                throw ex;
            }
        }
Exemple #34
0
 public void Add(Appointment entity)
 {
     appointmentDal.Add(entity);
 }
        private async void save_aptmt_btn_Clcik(object sender, RoutedEventArgs e)
        {
            bool isValid = true;

            try
            {
                EventStartTime.Time.ToString();
                // checks if the Event Name and Event Location are Empty
                if (EventName.Text.ToString() == "" || Location.Text == "")
                {
                    MessageDialog dialog = new MessageDialog("Event Name and Event Location must be ", "Oops..!");
                    await dialog.ShowAsync();

                    isValid = false;
                }

                // checks if event date has not been entered and if the date selected is less than the current date
                if (EventDate.Date == null || EventDate.Date < DateTimeNow.Date)
                {
                    MessageDialog dialog = new MessageDialog("Please select a valid date.\nRemember, the Event Date cannot be less than the current date.", "Oops..!");
                    await dialog.ShowAsync();

                    isValid = false;
                }


                // checks if the event date and the current date match
                if (EventDate.Date == DateTimeNow.Date)
                {
                    // checks if the start time
                    if (EventStartTime.Time < DateTimeNow.TimeOfDay)
                    {
                        MessageDialog dialog = new MessageDialog("The time selected is not valid. Start time has to be greater than current time ", "Oops..!");
                        await dialog.ShowAsync();

                        isValid = false;
                    }
                }

                // checks if Start Time is less than End Time
                if (EventStartTime.Time > EventEndTime.Time)
                {
                    MessageDialog dialog = new MessageDialog("The Start time must be less than the End time. Please change the time.", "Oops..!");
                    await dialog.ShowAsync();

                    isValid = false;
                }
            }
            catch (Exception ex)
            {
                MessageDialog infoBox = new MessageDialog("Sorry Something Went Wrong. Try Again. " + ex);
                await infoBox.ShowAsync();
            }

            if (isValid == true)
            {
                // converting CaldendarDatePicker value into DateTime object to modify dsiplaying format
                var      date       = EventDate.Date;
                DateTime event_date = date.Value.DateTime;

                // converting TimpePicker values into  DateTime objects to modify displaying format into AM/PM
                DateTime    eventStart_time = DateTime.Today.Add(EventStartTime.Time);
                DateTime    eventEnd_time   = DateTime.Today.Add(EventEndTime.Time);
                Appointment aptmObjSave     = new Appointment();
                aptmObjSave           = conn.Get <Appointment>(AppointmentPage.NavID);
                aptmObjSave.AptmtName = EventName.Text;
                aptmObjSave.AptmtDesc = EventDescription.Text;
                aptmObjSave.Location  = Location.Text;
                aptmObjSave.AptmtDate = event_date.ToString("dd.MM.yyyy");
                aptmObjSave.StartTime = eventStart_time.ToString("hh:mm tt");
                aptmObjSave.EndTime   = eventEnd_time.ToString("hh:mm tt");
                conn.Update(aptmObjSave);

                MessageDialog info = new MessageDialog("Appointment is successfully updated.");
                await info.ShowAsync();

                Frame.Navigate(typeof(AppointmentPage));
            }
        }
        private CallQueueCustomer CreateCustomerCallQueueCustomerModel(CallQueueCustomer existingCallQueueCustomer, CallQueueCustomer callQueueCustomer, Customer customer,
                                                                       IEnumerable <Call> customerCalls, int callAttempts, Appointment futureAppointment, ProspectCustomer prospectCustomer, EventAppointmentCancellationLog eacl,
                                                                       bool isConfirmationCallQueue, CustomerEligibility customerEligibility, IEnumerable <EventCustomer> eventCustomers, CustomerTargeted customerTargeted)
        {
            var lastCall = (from cc in customerCalls
                            where cc.Status != (long)CallStatus.CallSkipped &&
                            (isConfirmationCallQueue == false || cc.CallQueueId == callQueueCustomer.CallQueueId)
                            orderby cc.DateCreated descending
                            select cc).FirstOrDefault();

            if (existingCallQueueCustomer == null)
            {
                existingCallQueueCustomer             = callQueueCustomer;
                existingCallQueueCustomer.DateCreated = DateTime.Now;
                existingCallQueueCustomer.CallDate    = DateTime.Now;
            }
            else
            {
                existingCallQueueCustomer.CallDate = DateTime.Now;
            }

            existingCallQueueCustomer.IsActive = true;
            existingCallQueueCustomer.Status   = CallQueueStatus.Initial;

            existingCallQueueCustomer.FirstName  = customer.Name.FirstName;
            existingCallQueueCustomer.LastName   = customer.Name.LastName;
            existingCallQueueCustomer.MiddleName = customer.Name.MiddleName;

            existingCallQueueCustomer.PhoneHome   = customer.HomePhoneNumber;
            existingCallQueueCustomer.PhoneCell   = customer.MobilePhoneNumber;
            existingCallQueueCustomer.PhoneOffice = customer.OfficePhoneNumber;

            existingCallQueueCustomer.ZipId     = customer.Address.ZipCode.Id;
            existingCallQueueCustomer.ZipCode   = customer.Address.ZipCode.Zip;
            existingCallQueueCustomer.Tag       = customer.Tag;
            existingCallQueueCustomer.IsEligble = customerEligibility != null ? customerEligibility.IsEligible : null;
            existingCallQueueCustomer.IsIncorrectPhoneNumber = customer.IsIncorrectPhoneNumber;
            existingCallQueueCustomer.IsLanguageBarrier      = customer.IsLanguageBarrier;
            existingCallQueueCustomer.ActivityId             = customer.ActivityId;
            existingCallQueueCustomer.DoNotContactTypeId     = customer.DoNotContactTypeId;
            existingCallQueueCustomer.DoNotContactUpdateDate = customer.DoNotContactUpdateDate;

            existingCallQueueCustomer.AppointmentDate = futureAppointment != null ? futureAppointment.StartTime : (DateTime?)null;
            existingCallQueueCustomer.NoShowDate      = futureAppointment == null ? (eventCustomers.Any() ? eventCustomers.OrderByDescending(x => x.NoShowDate).First().NoShowDate : null) : null;

            if (!isConfirmationCallQueue)
            {
                existingCallQueueCustomer.CallCount = customerCalls.Count(x => x.IsContacted.HasValue && x.IsContacted.Value);
                existingCallQueueCustomer.Attempts  = callAttempts;

                existingCallQueueCustomer.CallStatus  = lastCall != null ? lastCall.Status : (long?)null;
                existingCallQueueCustomer.Disposition = lastCall != null ? lastCall.Disposition : string.Empty;
            }
            //confirm call queue - called then registered for another event, and queue regenerated
            existingCallQueueCustomer.ContactedDate = lastCall != null ? lastCall.DateCreated : (DateTime?)null;

            existingCallQueueCustomer.CallBackRequestedDate = null;
            if (prospectCustomer != null && lastCall != null && lastCall.Status == (long)CallStatus.Attended && lastCall.Disposition == ProspectCustomerTag.CallBackLater.ToString())
            {
                existingCallQueueCustomer.CallBackRequestedDate = prospectCustomer.CallBackRequestedDate;
            }

            existingCallQueueCustomer.AppointmentCancellationDate = (DateTime?)null;
            if (eacl != null && (lastCall == null || lastCall.DateCreated < eacl.DateCreated))
            {
                existingCallQueueCustomer.AppointmentCancellationDate = eacl.DateCreated;
            }

            existingCallQueueCustomer.DoNotContactUpdateSource       = customer.DoNotContactUpdateSource;
            existingCallQueueCustomer.LanguageBarrierMarkedDate      = customer.LanguageBarrierMarkedDate;
            existingCallQueueCustomer.IncorrectPhoneNumberMarkedDate = customer.IncorrectPhoneNumberMarkedDate;
            existingCallQueueCustomer.LanguageId = customer.LanguageId;

            if (customerTargeted != null)
            {
                existingCallQueueCustomer.TargetedYear = customerTargeted.ForYear;
                existingCallQueueCustomer.IsTargeted   = customerTargeted.IsTargated;
            }

            existingCallQueueCustomer.ProductTypeId = customer.ProductTypeId;

            return(existingCallQueueCustomer);
        }
Exemple #37
0
        private AppointmentViewModel FromAppointment(Appointment appt)
        {
            var factory = new AppointmentViewModelFactory();

            return(factory.CreateFromAppointment(appt));
        }
Exemple #38
0
        private bool TryCreateItem()
        {
            bool bItemCreated = false;

            try
            {
                if (_Folder.FolderClass.StartsWith("IPF.Appointment"))
                {
                    Appointment item = new Appointment(_Service);
                    //item.MimeContent = new MimeContent();

                    //MimeEntry oMimeEntry = new MimeEntry();
                    //oMimeEntry.ShowDialog();
                    string sContent = string.Empty;

                    if (chkIsBase64Encoded.Checked == true)
                    {
                        item.MimeContent.Content = Convert.FromBase64String(txtEntry.Text.Trim());
                    }
                    else
                    {
                        item.MimeContent.Content = System.Text.Encoding.UTF8.GetBytes(txtEntry.Text);
                    }

                    item.Save(_Folder.Id);

                    bItemCreated = true;
                    item         = null;
                }
                if (_Folder.FolderClass.StartsWith("IPF.Contact"))
                {
                    Contact item = new Contact(_Service);

                    if (chkIsBase64Encoded.Checked == true)
                    {
                        item.MimeContent.Content = Convert.FromBase64String(txtEntry.Text.Trim());
                    }
                    else
                    {
                        item.MimeContent.Content = System.Text.Encoding.UTF8.GetBytes(txtEntry.Text);
                    }

                    item.Save(_Folder.Id);
                    //this.RefreshContentAndDetails();


                    bItemCreated = true;
                    item         = null;
                }
                if (_Folder.FolderClass.StartsWith("IPF.Note"))
                {
                    EmailMessage item = new EmailMessage(_Service);

                    if (chkIsBase64Encoded.Checked == true)
                    {
                        item.MimeContent.Content = Convert.FromBase64String(txtEntry.Text.Trim());
                    }
                    else
                    {
                        item.MimeContent.Content = System.Text.Encoding.UTF8.GetBytes(txtEntry.Text);
                    }

                    item.Save(_Folder.Id);
                    //this.RefreshContentAndDetails();


                    bItemCreated = true;
                    item         = null;
                }
            }
            catch (Exception ex)
            {
                bItemCreated = false;
                MessageBox.Show(ex.InnerException.ToString(), "Error creating item");
            }

            return(bItemCreated);
        }
 public JsonResult MakeBooking(Appointment appt)
 {
     // statements to store new Appointment in a
     // repository would go here in a real project
     return(Json(appt, JsonRequestBehavior.AllowGet));
 }
 public ConsultRegisteredAppointmentsCommand(Appointment _Appointment)
 {
     this.Appointment = _Appointment;
 }
Exemple #41
0
 public BoundaryTest()
 {
     _medicineServices = new MedicineServices(medicineservice.Object);
     _adminMServices   = new AdminMedicineServices(adminservice.Object);
     _user             = new ApplicationUser()
     {
         UserId                = "5f8054f4914569df2b9e7d8e",
         Name                  = "Uma Kumar",
         Email                 = "*****@*****.**",
         Password              = "******",
         MobileNumber          = 9865253568,
         PinCode               = 820003,
         HouseNo_Building_Name = "9/11",
         Road_area             = "Road_area",
         City                  = "Gaya",
         State                 = "Bihar"
     };
     _category = new Category()
     {
         Id              = "5f0ff60a7b7be11c4c3c19e1",
         CatId           = 1,
         Url             = "~/Home",
         OpenInNewWindow = false
     };
     _medicine = new Medicine()
     {
         MedicineId = "5f802874c043a417142b7cc1",
         Name       = "Medicine-1",
         Brand      = "Brand-One",
         Price      = 123,
         Stock      = 10,
         Discount   = 10,
         Details    = "Medicine Details",
         Size       = "100Mg",
         Features   = "Medicine Feature for Medicine-1",
         CatId      = 1
     };
     _appointment = new Appointment()
     {
         AppointmentId = "5f805687914569df2b9e7d90",
         PatientName   = "Uma",
         DoctorName    = "R Kumar",
         Takendate     = DateTime.Now,
         Symtoms       = "Fever",
         PatientAge    = 30,
         Remark        = "Patient Remark"
     };
     _doctor = new Doctor()
     {
         DoctorId       = "5f802b2ec043a417142b7cc3",
         Name           = "R.R",
         Specialization = "MBBS - ENT",
         Qualification  = "MBBS",
         PracticingFrom = DateTime.Now
     };
     _medicineOrder = new MedicineOrder()
     {
         OrderId    = "5f805550914569df2b9e7d8f",
         MedicineId = "",
         UserId     = ""
     };
 }
Exemple #42
0
        private async Task LoadScheduleAsync()
        {
            if (Schedule == null)
            {
                DataSource = new ScheduleDataSource();
                Appointment a = ApplicationData.Current.NewAppointment;
                DataServiceResponse <ScheduleResults> response = await DataSource.GetAvailableTimes(StartDate,
                                                                                                    EndDate, a.BranchNumber,
                                                                                                    a.AppointmentType.Value,
                                                                                                    a.AppointmentSubType.Value,
                                                                                                    a.AppointmentLanguage);

                if (response.Success)
                {
                    if (string.IsNullOrEmpty(response.Data.ErrorMessage))
                    {
                        Schedule = response.Data;
                        foreach (ScheduleResult r in Schedule.ScheduleDays)
                        {
                            if (r.ScheduleDate.Date.Equals(SelectedDay.Date))
                            {
                                ReloadTable(new TimeSlotSource(r.TimeSlots));
                                break;
                            }
                        }
                        InvokeOnMainThread(() =>
                        {
                            ProgressRing.StopAnimating();
                        });
                    }
                    else
                    {
                        //scheduling system error
                        InvokeOnMainThread(() =>
                        {
                            ProgressRing.StopAnimating();
                            var alert = UIAlertController.Create("Schedule Engine Error", $"{response.Data.ErrorMessage}", UIAlertControllerStyle.Alert);
                            alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                            PresentViewController(alert, true, null);
                        });
                    }
                }
                else
                {
                    //error
                    InvokeOnMainThread(() =>
                    {
                        ProgressRing.StopAnimating();
                        var alert = UIAlertController.Create("Error", $"Load Error: {response.ErrorMessage}", UIAlertControllerStyle.Alert);
                        alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                        PresentViewController(alert, true, null);
                    });
                }
            }
            else
            {
                foreach (ScheduleResult r in Schedule.ScheduleDays)
                {
                    if (r.ScheduleDate.Date.Equals(SelectedDay.Date))
                    {
                        ReloadTable(new TimeSlotSource(r.TimeSlots));
                        break;
                    }
                }
            }
        }
Exemple #43
0
 public void Update(Appointment entity)
 {
     appointmentDal.Update(entity);
 }
        ///<summary>Returns null if there is no DFT defined for the enabled HL7Def.</summary>
        public static MessageHL7 GenerateDFT(List <Procedure> procList, EventTypeHL7 eventType, Patient pat, Patient guar, long aptNum, string pdfDescription, string pdfDataString)   //add event (A04 etc) parameters later if needed
        //In \\SERVERFILES\storage\OPEN DENTAL\Programmers Documents\Standards (X12, ADA, etc)\HL7\Version2.6\V26_CH02_Control_M4_JAN2007.doc
        //On page 28, there is a Message Construction Pseudocode as well as a flowchart which might help.
        {
            Provider    prov       = Providers.GetProv(Patients.GetProvNum(pat));
            Appointment apt        = Appointments.GetOneApt(aptNum);
            MessageHL7  messageHL7 = new MessageHL7(MessageTypeHL7.DFT);
            HL7Def      hl7Def     = HL7Defs.GetOneDeepEnabled();

            if (hl7Def == null)
            {
                return(null);
            }
            //find a DFT message in the def
            HL7DefMessage hl7DefMessage = null;

            for (int i = 0; i < hl7Def.hl7DefMessages.Count; i++)
            {
                if (hl7Def.hl7DefMessages[i].MessageType == MessageTypeHL7.DFT)
                {
                    hl7DefMessage = hl7Def.hl7DefMessages[i];
                    //continue;
                    break;
                }
            }
            if (hl7DefMessage == null)           //DFT message type is not defined so do nothing and return
            {
                return(null);
            }
            for (int s = 0; s < hl7DefMessage.hl7DefSegments.Count; s++)
            {
                int countRepeat = 1;
                if (hl7DefMessage.hl7DefSegments[s].SegmentName == SegmentNameHL7.FT1)
                {
                    countRepeat = procList.Count;
                }
                //for example, countRepeat can be zero in the case where we are only sending a PDF of the TP to eCW, and no procs.
                for (int repeat = 0; repeat < countRepeat; repeat++)           //FT1 is optional and can repeat so add as many FT1's as procs in procList
                //if(hl7DefMessage.hl7DefSegments[s].SegmentName==SegmentNameHL7.FT1) {
                {
                    if (hl7DefMessage.hl7DefSegments[s].SegmentName == SegmentNameHL7.FT1 && procList.Count > repeat)
                    {
                        prov = Providers.GetProv(procList[repeat].ProvNum);
                    }
                    SegmentHL7 seg = new SegmentHL7(hl7DefMessage.hl7DefSegments[s].SegmentName);
                    seg.SetField(0, hl7DefMessage.hl7DefSegments[s].SegmentName.ToString());
                    for (int f = 0; f < hl7DefMessage.hl7DefSegments[s].hl7DefFields.Count; f++)
                    {
                        string fieldName = hl7DefMessage.hl7DefSegments[s].hl7DefFields[f].FieldName;
                        if (fieldName == "")                       //If fixed text instead of field name just add text to segment
                        {
                            seg.SetField(hl7DefMessage.hl7DefSegments[s].hl7DefFields[f].OrdinalPos, hl7DefMessage.hl7DefSegments[s].hl7DefFields[f].FixedText);
                        }
                        else
                        {
                            //seg.SetField(hl7DefMessage.hl7DefSegments[s].hl7DefFields[f].OrdinalPos,
                            //FieldConstructor.GenerateDFT(hl7Def,fieldName,pat,prov,procList[repeat],guar,apt,repeat+1,eventType,pdfDescription,pdfDataString));
                            Procedure proc = null;
                            if (procList.Count > repeat)                           //procList could be an empty list
                            {
                                proc = procList[repeat];
                            }
                            seg.SetField(hl7DefMessage.hl7DefSegments[s].hl7DefFields[f].OrdinalPos,
                                         FieldConstructor.GenerateDFT(hl7Def, fieldName, pat, prov, proc, guar, apt, repeat + 1, eventType, pdfDescription, pdfDataString));
                        }
                    }
                    messageHL7.Segments.Add(seg);
                }
            }
            return(messageHL7);
        }
Exemple #45
0
 public void Delete(Appointment entity)
 {
     appointmentDal.Delete(entity);
 }
Exemple #46
0
        }                                     /// This will contain the response for the response code for this billing entry


        /// <summary>
        /// This method adds a billing code to a record and stores that record in
        /// the Billing database.
        /// </summary>
        /// <remarks>
        /// This method gets the billing information from the patient database needed,
        /// and the fee from the master file associated with that code. It then adds
        /// that record into a billing records database.
        /// </remarks>
        /// <param name="Date"> visit date </param>
        /// <param name="Code"> billing code </param>
        /// <param name="HCN"> health card number </param>
        public static bool AddBillingCode(Appointment apt, string[] codes1, string[] codes2)
        {
            BillingRecordsAccessor dal = new BillingRecordsAccessor();

            dal.Connect("ems_general", "qwerty");
            string money = "";

            try
            {
                //This is to be comented out if the date arrives in the correct format, otherwise use it
                string day   = apt.DateTime.Day.ToString();
                string month = apt.DateTime.Month.ToString();
                string year  = apt.DateTime.Year.ToString();
                if (apt.DateTime.Day.ToString().Length < 2)
                {
                    day = "0" + day;
                }
                if (apt.DateTime.Month.ToString().Length < 2)
                {
                    month = "0" + month;
                }
                if (apt.DateTime.Year.ToString().Length < 2)
                {
                    year = "0" + year;
                }

                string Date = year + month + day;

                //Now get the info from the appointment object,
                string Gender = apt.PatientHCN.Sex.ToString();

                foreach (string code in codes1)
                {
                    // here we search the database for the code
                    if (dal.CheckBillingCode(code))
                    {
                        money = dal.SearchBillingCode(code);
                    }
                    else
                    {
                        throw new ArgumentException(string.Format("Invalid Billing Code: {0}", code));
                    }

                    Billing BillingEntry = new Billing(month, Date, apt.PatientHCN.HCN.ToString(), char.Parse(Gender), code, money);
                    BillingEntry.GenerateMonthlyBillRecord();
                }
                foreach (string code in codes2)
                {
                    // here we search the database for the code
                    if (dal.CheckBillingCode(code))
                    {
                        money = dal.SearchBillingCode(code);
                    }
                    else
                    {
                        throw new ArgumentException(string.Format("Invalid Billing Code: {0}", code));
                    }

                    Billing BillingEntry = new Billing(month, Date, apt.PatientHCN.HCN.ToString(), char.Parse(Gender), code, money);
                    BillingEntry.GenerateMonthlyBillRecord();
                }
            }
            catch (ArgumentException e)
            {
                throw e;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            throw new BillingRecallException("Flag For Recall?");
        }
 public CustomAppointmentFormController(ASPxScheduler control, Appointment apt) : base(control, apt)
 {
 }
 static bool CompareAppointmentIds(Appointment apt, string id)
 {
     return(id == AppointmentIdHelper.GetAppointmentId(apt).ToString());
 }
 public void ThrowExceptionGivenInvalidTitle()
 {
     var appointment = Appointment.Create(testScheduleId, testClientId, testPatientId, testRoomId, testStartTime, testEndTime,
                                          testAppointmentTypeId, null, String.Empty);
 }
Exemple #50
0
 public void declineAppointment(Appointment app)
 {
 }
Exemple #51
0
 protected string GetContactValue(Appointment apt)
 {
     return(Convert.ToString(apt.CustomFields["Contact"]));
 }
        public void SetDoctorIdToDefaultValueGivenNull()
        {
            var appointment = Appointment.Create(testScheduleId, testClientId, testPatientId, testRoomId, testStartTime, testEndTime, testAppointmentTypeId, null, testTitle);

            Assert.AreEqual(1, appointment.DoctorId);
        }
        /// <summary>
        /// Populates the local database with 4 appointments for testing purposes.
        /// </summary>
        public static void PopulateLocalDatabase(int RT_id)
        {
            if (!USING_REMOTE_DATABASE)
            {
                Random rand = new Random();

                using (RTDbContext Context = InitializeDatabaseContext())
                {
                    List <Appointment> appts = new List <Appointment>();

                    DateTime DateTimeUniversalStart = DateTime.UtcNow.AddMinutes(1);

                    Appointment appt0 = new Appointment();
                    Appointment appt1 = new Appointment();
                    Appointment appt2 = new Appointment();
                    Appointment appt3 = new Appointment();

                    Coordinate coordinate0 = new Coordinate();
                    Coordinate coordinate1 = new Coordinate();
                    Coordinate coordinate2 = new Coordinate();
                    Coordinate coordinate3 = new Coordinate();

                    coordinate0.RightAscension = 10.3;
                    coordinate0.Declination    = 50.8;

                    coordinate1.RightAscension = 22.0;
                    coordinate1.Declination    = 83.63;

                    coordinate2.RightAscension = 16.0;
                    coordinate2.Declination    = 71.5;

                    coordinate3.RightAscension = 26.3;
                    coordinate3.Declination    = 85.12;

                    // Add drift scan appointment
                    appt0.StartTime          = DateTimeUniversalStart.AddSeconds(20 + rand.Next(30));
                    appt0.EndTime            = appt0.StartTime.AddSeconds(10 + rand.Next(90));
                    appt0.Status             = AppointmentStatusEnum.REQUESTED;
                    appt0.Type               = AppointmentTypeEnum.DRIFT_SCAN;
                    appt0.Orientation        = new Orientation(30, 30);
                    appt0.SpectraCyberConfig = new SpectraCyberConfig(SpectraCyberModeTypeEnum.CONTINUUM);
                    appt0.TelescopeId        = RT_id;
                    appt0.UserId             = 1;

                    // Add celesital body appointment
                    appt1.StartTime          = appt0.EndTime.AddSeconds(20 + rand.Next(30));
                    appt1.EndTime            = appt1.StartTime.AddSeconds(10 + rand.Next(90));
                    appt1.Status             = AppointmentStatusEnum.REQUESTED;
                    appt1.Type               = AppointmentTypeEnum.CELESTIAL_BODY;
                    appt1.CelestialBody      = new CelestialBody(CelestialBodyConstants.SUN);
                    appt1.SpectraCyberConfig = new SpectraCyberConfig(SpectraCyberModeTypeEnum.SPECTRAL);
                    appt1.TelescopeId        = RT_id;
                    appt1.UserId             = 1;

                    // Add point appointment
                    appt2.StartTime = appt1.EndTime.AddSeconds(20 + rand.Next(30));
                    appt2.EndTime   = appt2.StartTime.AddSeconds(10 + rand.Next(90));
                    appt2.Status    = AppointmentStatusEnum.REQUESTED;
                    appt2.Type      = AppointmentTypeEnum.POINT;
                    appt2.Coordinates.Add(coordinate2);
                    appt2.SpectraCyberConfig = new SpectraCyberConfig(SpectraCyberModeTypeEnum.CONTINUUM);
                    appt2.TelescopeId        = RT_id;
                    appt2.UserId             = 1;

                    // Add raster appointment
                    appt3.StartTime = appt2.EndTime.AddSeconds(20 + rand.Next(30));
                    appt3.EndTime   = appt3.StartTime.AddMinutes(10 + rand.Next(90));
                    appt3.Status    = AppointmentStatusEnum.REQUESTED;
                    appt3.Type      = AppointmentTypeEnum.RASTER;
                    appt3.Coordinates.Add(coordinate0);
                    appt3.Coordinates.Add(coordinate1);
                    appt3.SpectraCyberConfig = new SpectraCyberConfig(SpectraCyberModeTypeEnum.CONTINUUM);
                    appt3.TelescopeId        = RT_id;
                    appt3.UserId             = 1;

                    appts.AddRange(new Appointment[] { appt0, appt1, appt2, appt3 });

                    Context.Appointments.AddRange(appts);
                    SaveContext(Context);
                }
            }
        }
Exemple #54
0
 public async Task <IEnumerable <Appointment> > GetAllAppointmentsByTherapistId(Appointment appointment)
 {
     return(await _context.Appointment
            .Where(a => a.StartTime >= appointment.StartTime &&
                   a.EndTime <= appointment.EndTime &&
                   a.Active &&
                   a.TherapistId == appointment.TherapistId)
            .ToListAsync());
 }
Exemple #55
0
        /// <summary>
        /// 导入
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public JsonResult Upload()
        {
            AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载

            ajax.status = EnumAjaxStatus.Error;           //默认失败
            ajax.msg    = "导入失败!";                        //前台获取,用于显示提示信息
            var data = Request["data"];                   //获取前台传递的数据,主要序列化

            if (string.IsNullOrEmpty(data))
            {
                return(Json(ajax));
            }
            JObject jsonObj  = JObject.Parse(data);
            var     fileTemp = jsonObj["fileTemp"].ToString();


            var fileExt = jsonObj["fileExt"].ToString();


            string path = Picture.DPSaveOrderFile(string.Format("报名数据表{0}.xls", string.Format("{0:yyyyMMddHHmmssffff}", DateTime.Now)), "Execl", fileTemp);



            DataTable dt     = Picture.GetData(path, fileExt).Tables[0];
            string    ApName = dt.Columns["学员姓名"].ToString();

            if (string.IsNullOrEmpty(ApName))
            {
                ajax.msg = "列学员姓名不存在!";
                return(Json(ajax));
            }
            string ApTel = dt.Columns["绑定的手机"].ToString();

            if (string.IsNullOrEmpty(ApTel))
            {
                ajax.msg = "列绑定的手机不存在!";
                return(Json(ajax));
            }
            string ComCode = dt.Columns["所属分校"].ToString(); //所属分校,1舜浦,2吾悦

            if (string.IsNullOrEmpty(ComCode))
            {
                ajax.msg = "列所属分校不存在!";
                return(Json(ajax));
            }
            string APRemark = dt.Columns["备注"].ToString();

            if (string.IsNullOrEmpty(APRemark))
            {
                ajax.msg = "列备注不存在!";
                return(Json(ajax));
            }

            Appointment app = new Appointment();

            app.ApStateID  = 0;                  //初始状态默认0
            app.CreateTime = DateTime.Now;       //创建时间
            app.CreatorId  = UserSession.userid; //创建人
            foreach (DataRow dr in dt.Rows)
            {
                app.ApName = dr["学员姓名"].ToString();
                app.ApTel  = dr["绑定的手机"].ToString();
                if (dr["所属分校"].ToString() == "舜浦")
                { //所属分校,1舜浦,2吾悦
                    app.ComCode = "1";
                }
                else if (dr["所属分校"].ToString() == "吾悦")
                {
                    app.ComCode = "2";
                }
                app.ID       = CommonData.DPGetTableMaxId("AP", "ID", "Appointment", 8);
                app.APRemark = dr["备注"].ToString();
                AppointmentData.Add(app);
            }



            ajax.msg    = "导入成功!";
            ajax.status = EnumAjaxStatus.Success;
            //ajax.data = ret;
            return(Json(ajax));
        }
Exemple #56
0
        // Test this Calendar Item's properties.
        public static void ProcessItem(Appointment appt)
        {
            // populate the values for the properties
            try
            {
                if (appt.Size > 0)
                {
                    if (bVerbose)
                    {
                        outLog.WriteLine("Calling to Get Readable Properties from the following item.");
                    }
                    GetPropsReadable(appt);
                }
                else
                {
                    DisplayAndLog("Appointment item not valid - continuing...");
                    return;
                }
            }
            catch
            {
                DisplayAndLog("Getting props failed or item is NULL - continuing...");
                return;
            }

            string strLogItem = "Problem item: " + strSubject + " | " + strLocation + "| " + strStartWhole + " | " + strEndWhole;

            if (bVerbose)
            {
                string strItemsChecked = (iCheckedItems + 1).ToString();
                outLog.WriteLine("Checking item " + strItemsChecked + ": " + strSubject + " | " + strStartWhole + "|" + strEndWhole);
            }

            foreach (string strVal in appt.Categories)
            {
                if (strVal.ToUpper() == "HOLIDAY")
                {
                    return; // we will skip testing holiday items since they are imported and should be okay
                }
            }

            List <string> strErrors     = new List <string>();
            bool          bErr          = false;
            bool          bWarn         = false;
            bool          bOrgTest      = true;
            DateTime      dtStart       = DateTime.MinValue;
            DateTime      dtEnd         = DateTime.MinValue;
            int           iDel          = 0;
            int           iMod          = 0;
            int           iExcept       = 0;
            string        strRecurStart = "";
            string        strRecurEnd   = "";
            DateTime      dtRecurStart  = DateTime.MinValue;
            DateTime      dtRecurEnd    = DateTime.MinValue;

            // parse the recurrence blob and get useful stuff out of it
            if (!string.IsNullOrEmpty(strRecurBlob))
            {
                GetRecurData(strRecurBlob);
                if (!(string.IsNullOrEmpty(strRecurDelInstCount) && !(string.IsNullOrEmpty(strRecurModInstCount))))
                {
                    iDel                = int.Parse(strRecurDelInstCount);
                    iMod                = int.Parse(strRecurModInstCount);
                    iExcept             = iDel - iMod;
                    strRecurExceptCount = iExcept.ToString();
                }
                if (!(string.IsNullOrEmpty(strRecurStartDate) && !(string.IsNullOrEmpty(strRecurStartTime))))
                {
                    strRecurStart = strRecurStartDate + " " + strRecurStartTime;
                    dtRecurStart  = DateTime.Parse(strRecurStart);
                }
                if (!(string.IsNullOrEmpty(strRecurEndDate) && !(string.IsNullOrEmpty(strRecurEndTime))))
                {
                    strRecurEnd = strRecurEndDate + " " + strRecurEndTime;
                    dtRecurEnd  = DateTime.Parse(strRecurEnd);
                }
            }

            string strOrganizerSMTP = "";
            string strMbxSMTP       = strSMTPAddr;

            // get the SMTP address of the Organizer by doing Resolve Name on the X500 address.
            if (!(string.IsNullOrEmpty(strOrganizerAddr)))
            {
                NameResolutionCollection ncCol = null;
                try
                {
                    ncCol = Utils.exService.ResolveName(strOrganizerAddr);
                }
                catch (ServiceRequestException ex)
                {
                    strErrors.Add("   Error when attempting to resolve the name for " + strOrganizerAddr + ":");
                    strErrors.Add("   " + ex.Message);
                    iWarn++;
                }

                if (ncCol.Count > 0 && !string.IsNullOrEmpty(ncCol[0].Mailbox.Address))
                {
                    strOrganizerSMTP = ncCol[0].Mailbox.Address;
                }
                else
                {
                    bOrgTest         = false;
                    strOrganizerSMTP = strOrganizerAddr;
                }
            }
            else
            {
                strOrganizerAddr = "";
            }


            // now really actually start testing props

            if (string.IsNullOrEmpty(strSubject))
            {
                bWarn = true;
                strErrors.Add("   WARNING: Subject is empty/missing.");
                iWarn++;
                strSubject = "";
            }
            else // need to remove commas for logging purposes
            {
                if (strSubject.Contains(","))
                {
                    strSubject = strSubject.Replace(',', '_');
                }
            }

            if (string.IsNullOrEmpty(strEndWhole))
            {
                bErr = true;
                strErrors.Add("   ERROR: Missing required End Time property.");
                iErrors++;
            }
            else // not empty/missing, but might still have problems
            {
                dtEnd = DateTime.Parse(strEndWhole);

                if (TimeCheck(dtEnd))
                {
                    bErr = true;
                    strErrors.Add("   ERROR: End Time is not set correctly.");
                    iErrors++;
                }
            }

            if (string.IsNullOrEmpty(strStartWhole))
            {
                bErr = true;
                strErrors.Add("   ERROR: Missing required Start Time property.");
                iErrors++;
            }
            else // not empty/missing, but might still have problems
            {
                dtStart = DateTime.Parse(strStartWhole);

                if (dtEnd < dtStart)
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Start Time is greater than the End Time.");
                    iErrors++;
                }

                if (TimeCheck(dtStart))
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Start Time is set to an invalid value.");
                    iErrors++;
                }
            }

            if (string.IsNullOrEmpty(strOrganizerAddr))
            {
                if (int.Parse(strApptStateFlags) > 0) // if no Organizer Address AND this is a meeting then that's bad.
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Missing required Organizer Address property.");
                    iErrors++;
                }
                strOrganizerAddr = "";
            }

            if (string.IsNullOrEmpty(strRecurring))
            {
                bErr = true;
                strErrors.Add("   ERROR: Missing required Recurring property.");
                iErrors++;
                strRecurring = "MISSING";
            }

            if (string.IsNullOrEmpty(strLocation))
            {
                strLocation = "";
            }
            else
            {
                if (strLocation.Contains(","))
                {
                    strLocation = strLocation.Replace(',', '_');
                }
            }

            // check for duplicate calendar items
            string strDupLine = strSubject + "," + strLocation + "," + strOrganizerAddr + "," + strRecurring + "," + strStartWhole + "," + strEndWhole;

            if (strDupCheck.Count > 0)
            {
                bool bAdd = true;
                foreach (string str in strDupCheck)
                {
                    string strSubj  = str.Split(',')[0];
                    string strStart = str.Split(',')[4];
                    string strEnd   = str.Split(',')[5];
                    if (str == strDupLine)
                    {
                        bErr = true;
                        strErrors.Add("   ERROR: Duplicate Items.");
                        strErrors.Add("          This Item: " + strSubject + " | " + strStartWhole + " | " + strEndWhole);
                        strErrors.Add("          Other Item: " + strSubj + " | " + strStart + " | " + strEnd);
                        iErrors++;
                        bAdd = false;
                    }
                }
                if (bAdd)
                {
                    strDupCheck.Add(strDupLine);
                }
            }
            else
            {
                strDupCheck.Add(strDupLine);
            }

            if (string.IsNullOrEmpty(strDeliveryTime))
            {
                if (int.Parse(strApptStateFlags) > 0) // single Appt might not need Delivery time.
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Missing required Delivery Time property.");
                    iErrors++;
                }
            }

            // Do some tests if the item is a recurring item
            if (strRecurring.ToUpper() == "TRUE")
            {
                if (iMod > iDel)
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Recurrence Data is corrupt.");
                    iErrors++;
                }

                if (TimeCheck(dtRecurStart))
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Recurrence Start Time is set to an invalid value.");
                    iErrors++;
                }

                if (TimeCheck(dtRecurEnd))
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Recurrence End Time is set to an invalid value.");
                    iErrors++;
                }

                iRecurItems++;
                if (iRecurItems == 1299)
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Reached limit of 1300 Recurring Appointments. Delete some older recurring appointments to correct this.");
                    iErrors++;
                }
                if (iRecurItems == 1250)
                {
                    bWarn = true;
                    strErrors.Add("   WARNING: Approaching limit of 1300 Recurring Appointments. Delete some older recurring appointments to correct this.");
                    iWarn++;
                }
            }

            if (dtStart < dtOld)
            {
                if (!(strAllDay.ToUpper() == "TRUE"))
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Start time set previous to 1990.");
                    iErrors++;
                }
                else
                {
                    bWarn = true;
                    strErrors.Add("   WARNING: All day event set with event date before 1990.");
                    iWarn++;
                }
            }

            if (dtStart > dtFuture)
            {
                if (!(strAllDay.ToUpper() == "TRUE"))
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Start time set after the year 2100.");
                    iErrors++;
                }
                else
                {
                    bWarn = true;
                    strErrors.Add("   WARNING: All day event set with event date after 2100.");
                    iWarn++;
                }
            }

            if (string.IsNullOrEmpty(strSenderName))
            {
                if (int.Parse(strApptStateFlags) > 0) // if no Sender Name AND this is a meeting then that's bad.
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Missing required Sender Name property.");
                    iErrors++;
                }
            }

            if (string.IsNullOrEmpty(strSenderAddr))
            {
                if (int.Parse(strApptStateFlags) > 0) // if no Sender Address AND this is a meeting then that's bad.
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Missing required Sender Address property.");
                    iErrors++;
                }
            }

            if (string.IsNullOrEmpty(strMsgClass))
            {
                bErr = true;
                strErrors.Add("   ERROR: Missing required Message Class property.");
                iErrors++;
            }
            else
            {
                bool bFound = false;
                foreach (string strClass in calMsgClasses)
                {
                    if (strClass == strMsgClass)
                    {
                        bFound = true;
                        break; // if one of the known classes then all is good.
                    }
                }

                if (!bFound)
                {
                    if (!(strMsgClass.Contains("IPM.Appointment")))
                    {
                        bErr = true;
                        strErrors.Add("   ERROR: Unknown or incorrect Message Class " + strMsgClass + " is set on this item.");
                        iErrors++;
                    }
                    else
                    {
                        bWarn = true;
                        strErrors.Add("   WARNING: Unknown Message Class " + strMsgClass + " is set on this item.");
                        iWarn++;
                    }
                }
            }

            if (iExcept >= 25)
            {
                bWarn = true;
                strErrors.Add("   WARNING: Meeting has " + strRecurExceptCount + " exceptions which may indicate a problematic long-running recurring meeting.");
                iWarn++;
            }

            if (!(string.IsNullOrEmpty(strMsgSize)))
            {
                int    iSize  = int.Parse(strMsgSize);
                string strNum = "";


                if (iSize >= 52428800)
                {
                    strNum = "50M";
                }
                else if (iSize >= 26214400)
                {
                    strNum = "25M";
                }
                else if (iSize >= 10485760)
                {
                    strNum = "10M";
                }

                if (iSize >= 10485760) // if >= 10M then one of the above is true...
                {
                    bWarn = true;
                    iWarn++;
                    if (strHasAttach.ToUpper() == "TRUE" && strRecurring.ToUpper() == "TRUE")
                    {
                        strErrors.Add("   WARNING: Message size exceeds " + strNum + " which may indicate a problematic long-running recurring meeting.");
                    }
                    else if (strHasAttach.ToUpper() == "TRUE")
                    {
                        strErrors.Add("   WARNING: Message size exceeds " + strNum + " but is not set as recurring. Might have large and/or many attachments.");
                    }
                    else
                    {
                        strErrors.Add("   WARNING: Message size exceeds " + strNum + " but has no attachments. Might have some large problem properties.");
                    }
                }
            }

            if (string.IsNullOrEmpty(strApptStateFlags)) //
            {
                bErr = true;
                strErrors.Add("   ERROR: Missing required Appointment State property.");
                iErrors++;
            }
            else
            {
                // check for meeting hijack items
                switch (strApptStateFlags)
                {
                case "0":     // Non-meeting appointment
                {
                    //single appointment I made in my Calendar
                    break;
                }

                case "1":     // Meeting and I am the Organizer
                {
                    if (!string.IsNullOrEmpty(strOrganizerAddr) && !string.IsNullOrEmpty(strOrganizerSMTP))
                    {
                        if (!(strOrganizerSMTP.ToUpper() == strMbxSMTP))         // this user's email should match with the Organizer. If not then error.
                        {
                            if (bOrgTest)
                            {
                                bErr = true;
                                strErrors.Add("   ERROR: Organizer properties are in conflict.");
                                strErrors.Add("          Organizer Address: " + strOrganizerAddr);
                                strErrors.Add("          Appt State: " + strDisplayName + " is the Organizer");
                                iErrors++;
                            }
                            else
                            {
                                bWarn = true;
                                strErrors.Add("   WARNING: Organizer properties might be in conflict.");
                                strErrors.Add("            Organizer Address: " + strOrganizerAddr);
                                strErrors.Add("            Appt State: " + strDisplayName + " is the Organizer");
                                strErrors.Add("            If the address above is one of the proxyAddresses for " + strDisplayName + " then all is good.");
                                iWarn++;
                            }
                        }
                    }
                    break;
                }

                case "2":     // Received item - shouldn't be in this state
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Appointment State is an incorrect value.");
                    iErrors++;
                    break;
                }

                case "3":     // Meeting item that I received - I am an Attendee
                {
                    if (!string.IsNullOrEmpty(strOrganizerAddr) && !string.IsNullOrEmpty(strOrganizerSMTP))
                    {
                        if (strOrganizerSMTP.ToUpper() == strMbxSMTP)         // this user's email should NOT match with the Organizer. If it does then error.
                        {
                            if (bOrgTest)
                            {
                                bErr = true;
                                strErrors.Add("   ERROR: Organizer properties are in conflict.");
                                strErrors.Add("          Organizer Address: " + strOrganizerAddr);
                                strErrors.Add("          Appt State: " + strDisplayName + " is an Attendee");
                                iErrors++;
                            }
                            else
                            {
                                bWarn = true;
                                strErrors.Add("   WARNING: Organizer properties might be in conflict.");
                                strErrors.Add("            Organizer Address: " + strOrganizerAddr);
                                strErrors.Add("            Appt State: " + strDisplayName + " is an Attendee");
                                strErrors.Add("            If the address above is NOT a proxyAddress for " + strDisplayName + " then all is good.");
                                iWarn++;
                            }
                        }
                    }
                    break;
                }

                default:     // nothing else matters yet - can add later if needed
                {
                    break;
                }
                }
            }

            if (string.IsNullOrEmpty(strTZDefStart))
            {
                if (strRecurring.ToUpper() == "TRUE")
                {
                    bErr = true;
                    strErrors.Add("   ERROR: Missing required Timezone property.");
                    iErrors++;
                }
            }

            // GlobalObjectID check
            if (int.Parse(strApptStateFlags) > 0) /// Global Obj IDs count when it's an actual Meeting, not single Appt.
            {
                bool bAdd = true;

                if (string.IsNullOrEmpty(strGlobalObjID))
                {
                    bErr = true;
                    strErrors.Add("   ERROR: No GlobalObjectID property detected on this meeting item.");
                    iErrors++;
                }

                if (string.IsNullOrEmpty(strCleanGlobalObjID))
                {
                    bErr = true;
                    strErrors.Add("   ERROR: No CleanGlobalObjectID property detected on this meeting item.");
                    iErrors++;
                }

                if (!(string.IsNullOrEmpty(strGlobalObjID)) || (!(string.IsNullOrEmpty(strCleanGlobalObjID)))) // if both are empty then don't bother testing
                {
                    string strGOIDs = strGlobalObjID + "," + strCleanGlobalObjID + "," + strSubject + "," + strStartWhole + "," + strEndWhole;

                    if (strGOIDCheck.Count > 0)
                    {
                        foreach (string str in strGOIDCheck)
                        {
                            string strGOID      = str.Split(',')[0];
                            string strCleanGOID = str.Split(',')[1];
                            string strSubj      = str.Split(',')[2];
                            string strStart     = str.Split(',')[3];
                            string strEnd       = str.Split(',')[4];

                            if (strGOID == strGlobalObjID && strCleanGOID == strCleanGlobalObjID)
                            {
                                bErr = true;
                                strErrors.Add("   ERROR: Duplicate GlobalObjectID properties detected on two items.");
                                strErrors.Add("          This item: " + strSubject + " | " + strStartWhole + " | " + strEndWhole);
                                strErrors.Add("          Other item: " + strSubj + " | " + strStart + " | " + strEnd);
                                iErrors++;
                                bAdd = false;
                            }
                            else if (strGOID == strGlobalObjID)
                            {
                                if (!(string.IsNullOrEmpty(strGlobalObjID)))
                                {
                                    bErr = true;
                                    strErrors.Add("   ERROR: Duplicate GlobalObjectID prop detected on two items.");
                                    strErrors.Add("          This item: " + strSubject + " | " + strStartWhole + " | " + strEndWhole);
                                    strErrors.Add("          Other item: " + strSubj + " | " + strStart + " | " + strEnd);
                                    iErrors++;
                                }
                                bAdd = false;
                            }
                            else if (strCleanGOID == strCleanGlobalObjID)
                            {
                                if (!(string.IsNullOrEmpty(strCleanGlobalObjID)))
                                {
                                    bErr = true;
                                    strErrors.Add("   ERROR: Duplicate CleanGlobalObjectID prop detected on two items.");
                                    strErrors.Add("          This item: " + strSubject + " | " + strStartWhole + " | " + strEndWhole);
                                    strErrors.Add("          Other item: " + strSubj + " | " + strStart + " | " + strEnd);
                                    iErrors++;
                                }
                                bAdd = false;
                            }
                        }
                        if (bAdd)
                        {
                            strGOIDCheck.Add(strGOIDs);
                        }
                    }
                    else
                    {
                        strGOIDCheck.Add(strGOIDs);
                    }
                }
            }

            //
            // Now do the reporting and moving of items as needed
            //

            if (bErr || bWarn)
            {
                outLog.WriteLine(strLogItem);
                // AND log out each line in the List of errors
                foreach (string strLine in strErrors)
                {
                    outLog.WriteLine(strLine);
                }
                outLog.WriteLine("");
            }

            // Move items to CalVerifier folder if error is flagged and in "move" mode
            if (bMoveItems && bErr)
            {
                appt.Move(fldCalVerifier.Id);
            }

            ResetProps(); // reset the properties for each item.
        }
Exemple #57
0
        // Populate the property values for each of the props the app checks on.
        // Some tests require multiple props, so best to go ahead and just get them all first.
        public static void GetPropsReadable(Appointment appt)
        {
            string strHexTag   = "";
            string strPropName = "";
            string strSetID    = "";
            string strGUID     = "";
            string strValue    = "";
            string strType     = "";

            foreach (ExtendedProperty extProp in appt.ExtendedProperties)
            {
                // Get the Tag
                if (extProp.PropertyDefinition.Tag.HasValue)
                {
                    strHexTag = extProp.PropertyDefinition.Tag.Value.ToString("X4");
                }
                else if (extProp.PropertyDefinition.Id.HasValue)
                {
                    strHexTag = extProp.PropertyDefinition.Id.Value.ToString("X4");
                }

                // Get the SetID for named props
                if (extProp.PropertyDefinition.PropertySetId.HasValue)
                {
                    strGUID  = extProp.PropertyDefinition.PropertySetId.Value.ToString("B");
                    strSetID = PropSet.GetSetIDFromGUID(strGUID);
                }

                // Get the Property Type
                strType = extProp.PropertyDefinition.MapiType.ToString();

                // Get the Prop Name
                strPropName = PropSet.GetPropNameFromTag(strHexTag, strSetID);

                // if it's binary then convert it to a string-ized binary - will be converted using MrMapi
                if (strType == "Binary")
                {
                    byte[] binData = extProp.Value as byte[];
                    strValue = GetStringFromBytes(binData);
                }
                else
                {
                    if (extProp.Value != null)
                    {
                        strValue = extProp.Value.ToString();
                    }
                }

                switch (strPropName)
                {
                case "PR_SUBJECT_W":
                {
                    strSubject = strValue;
                    break;
                }

                case "PR_SENT_REPRESENTING_NAME_W":
                {
                    strOrganizerName = strValue;
                    break;
                }

                case "PR_SENT_REPRESENTING_EMAIL_ADDRESS_W":
                {
                    strOrganizerAddr = strValue;
                    break;
                }

                case "PR_SENT_REPRESENTING_ADDRTYPE_W":
                {
                    strOrganizerAddrType = strValue;
                    break;
                }

                case "PR_SENDER_NAME_W":
                {
                    strSenderName = strValue;
                    break;
                }

                case "PR_SENDER_EMAIL_ADDRESS_W":
                {
                    strSenderAddr = strValue;
                    break;
                }

                case "PR_MESSAGE_CLASS":
                {
                    strMsgClass = strValue;
                    break;
                }

                case "PR_LAST_MODIFICATION_TIME":
                {
                    strLastModified = strValue;
                    break;
                }

                case "PR_LAST_MODIFIER_NAME_W":
                {
                    strLastModifiedBy = strValue;
                    break;
                }

                case "PR_ENTRYID":
                {
                    strEntryID = strValue;
                    break;
                }

                case "PR_MESSAGE_SIZE":
                {
                    strMsgSize = strValue;
                    break;
                }

                case "PR_MESSAGE_DELIVERY_TIME":
                {
                    strDeliveryTime = strValue;
                    break;
                }

                case "PR_HASATTACH":
                {
                    strHasAttach = strValue;
                    break;
                }

                case "PR_MSG_STATUS":
                {
                    strMsgStatus = strValue;
                    break;
                }

                case "PR_CREATION_TIME":
                {
                    strCreateTime = strValue;
                    break;
                }

                case "dispidRecurring":
                {
                    strRecurring = strValue;
                    break;
                }

                case "dispidRecurType":
                {
                    strRecurType = strValue;
                    break;
                }

                case "dispidApptStartWhole":
                {
                    strStartWhole = strValue;
                    break;
                }

                case "dispidApptEndWhole":
                {
                    strEndWhole = strValue;
                    break;
                }

                case "dispidApptStateFlags":
                {
                    strApptStateFlags = strValue;
                    break;
                }

                case "dispidLocation":
                {
                    strLocation = strValue;
                    break;
                }

                case "dispidTimeZoneDesc":
                {
                    strTZDesc = strValue;
                    break;
                }

                case "dispidApptSubType":
                {
                    strAllDay = strValue;
                    break;
                }

                case "dispidApptRecur":
                {
                    strRecurBlob = strValue;
                    break;
                }

                case "PidLidIsRecurring":
                {
                    strIsRecurring = strValue;
                    break;
                }

                case "PidLidGlobalObjectId":
                {
                    strGlobalObjID = strValue;
                    break;
                }

                case "PidLidCleanGlobalObjectId":
                {
                    strCleanGlobalObjID = strValue;
                    break;
                }

                case "dispidApptAuxFlags":
                {
                    strAuxFlags = strValue;
                    break;
                }

                case "PidLidIsException":
                {
                    strIsException = strValue;
                    break;
                }

                case "dispidTimeZoneStruct":
                {
                    strTZStruct = strValue;
                    break;
                }

                case "dispidApptTZDefStartDisplay":
                {
                    strTZDefStart = strValue;
                    break;
                }

                case "dispidApptTZDefEndDisplay":
                {
                    strTZDefEnd = strValue;
                    break;
                }

                case "dispidApptTZDefRecur":
                {
                    strTZDefRecur = strValue;
                    break;
                }

                case "dispidPropDefStream":
                {
                    strPropDefStream = strValue;
                    break;
                }

                default:
                {
                    break;
                }
                }
            }
            return;
        }
 public bool UpdateAppointment(Appointment _Appointment)
 {
     return(new UserDAL().UpdateAppointment(_Appointment));
 }
        public void CanConstruct()
        {
            var instance = new Appointment();

            Assert.IsNotNull(instance);
        }
 public int PostAddAppointment([FromBody] Appointment appointment)
 {
     return(repository.AddAppointment(appointment));
 }