public PrintScriiption(Visit visit)
 {
     InitializeComponent();
     SystemSettings setting = DataLayer.GetSystemSettings();
     clinicName.Text = setting.CilinicName;
     if (setting.ClinicImage != null)
     {
         MemoryStream ms = new MemoryStream();
         setting.ClinicImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
         ms.Position = 0;
         BitmapImage bi = new BitmapImage();
         bi.BeginInit();
         bi.StreamSource = ms;
         bi.EndInit();
         clinicLogo.Source = bi;
     }
     patientName.Text = visit.Patient.ToString();
     visitDate.Text = visit.PersianDate;
     address.Text = setting.CilinicAddress;
     phoneNumber.Text = setting.CilinicPhone;
     int i = 1;
     foreach(VisitDrug visDrug in visit.VisitDrugs)
     {
         TableRow row = new TableRow();
         row.Cells.Add(new TableCell(new Paragraph(new Run(i+++""))));
         row.Cells.Add(new TableCell(new Paragraph(new Run(visDrug.Drug.Title))));
         row.Cells.Add(new TableCell(new Paragraph(new Run(visDrug.CustomManual))));
         drugTable.Rows.Add(row);
     }
     DoctorCode.Text = visit.Doctor.DoctorCode;
     DoctorName.Text = visit.Doctor.ToString();
 }
        public VisitPrint(Visit visit)
        {
            InitializeComponent();

            TableCell r1 = new TableCell(new Paragraph(new Run(visit.Patient.AccountantCode)));
            header.Rows[0].Cells.Add(r1);

            TableCell r2 = new TableCell(new Paragraph(new Run(visit.Patient.ToString())));
            header.Rows[0].Cells.Add(r2);

            TableCell r3 = new TableCell(new Paragraph(new Run(visit.Doctor.ToString())));
            header.Rows[0].Cells.Add(r3);

            TableCell r4 = new TableCell(new Paragraph(new Run(new PersianDate(visit.FromTime).ToString())));
            header.Rows[0].Cells.Add(r4);

            foreach (VisitService s in visit.VisitServices)
            {

                TableRow r = new TableRow();
                TableCell c1 = new TableCell(new Paragraph(new Run(s.Service.Title)));
                r.Cells.Add(c1);
                TableCell c2 = new TableCell(new Paragraph(new Run(new PatientHistory(s).Insurance)));
                r.Cells.Add(c2);
                TableCell c3 = new TableCell(new Paragraph(new Run(s.ToothDescription)));
                r.Cells.Add(c3);
                TableCell c4 = new TableCell(new Paragraph(new Run(s.FinalCost.ToString("n0"))));
                r.Cells.Add(c4);

                tblServices.Rows.Add(r);
            }

            comment.Inlines.Add(new Run(visit.Comment));
            Fee.Inlines.Add(new Run("  "+visit.FinalSumCost.ToString("n0")+" ریال"));
        }
        public SendSmsReminder()
        {
            this.FormClosed += (x, y) =>
            {
                file.WriteLine("5");
                DataLayer.EndTransaction();
                file.Close();
            };
            file.AutoFlush = true;
            file.WriteLine("1");
            DataLayer.BeginTransaction();
            smsSender = new SmsSender();
            smsSender.SendCompleted += new SmsSender.SendCompletedEventHandler(smsSender_SendCompleted);
            file.WriteLine("2");
            try
            {
                //get the reminder enable bool if it is true
                SystemSettings setting = DataLayer.GetSystemSettings();
                if (setting != null && setting.SendReminder)
                {
                    Visit[] visits = DataLayer.GetVisits(true).Where(x => x.ReminderStatus == (int)SmsStatus.WaitingForSent && (x.FromTime - DateTime.Now).TotalDays <= setting.ReminderDay && (x.FromTime - DateTime.Now).TotalHours > 0 && !string.IsNullOrEmpty(x.Patient.CellNumber)).ToArray();
                    foreach (Visit vis in visits)
                    {
                        proccessingVisit = vis;
                        smsSender.Say(string.Format(setting.ReminderText, vis.Patient.ToString(), vis.PersianDate, vis.FromTime.TimeOfDay)).To(vis.Patient.CellNumber).SendAsync(setting.SmsUsername, setting.SmsPassword, 0);
                        while (!afterSend) ;
                        afterSend = !afterSend;
                    }
                    if (visits.Count() != 0)
                    {
                        DataLayer.Save();
                    }
                    Close();
                }
            }
            catch (Exception e)
            {
                file.WriteLine(e.Message);
            }


        }
        private void LoadAndSetVisitDetails(Visit visit)
        {
            grvVisitService.DataSource = visit.VisitServices;
            grvVisitService.CurrentRow = null;

            grvDrugs.DataSource = visit.VisitDrugs;
            grvDrugs.CurrentRow = null;

            SetVisitTooth(visit);
        }
        private void SetVisitTooth(Visit visit)
        {
            uint tooths = 0;
            foreach (VisitService service in visit.VisitServices)
            {
                tooths = tooths | (uint)service.Tooth;
            }

            ucTooth.SelectedTooths = tooths;
        }
Exemple #6
0
        private uint toothValue(Visit[] visits)
        {
            uint allTeeth = 0;
            foreach (Visit v in visits)
            {
                foreach (VisitService vssrv in v.VisitServices)
                {
                    allTeeth = allTeeth | (uint)vssrv.Tooth;

                }
            }
            return allTeeth;
        }
Exemple #7
0
        public static bool InOfficeTimeRange(Visit entity)
        {
            EntityModelContainer context = entity.Context;

            return context.Timmings.Execute(MergeOption.NoTracking).Any
                (t => t.DayOfWeek == (int)entity.ToTime.Date.DayOfWeek &&
                (
                    ((entity.ToTime.TimeOfDay >= t.From.TimeOfDay) && (entity.ToTime.TimeOfDay <= t.To.TimeOfDay))
                    &&
                    ((entity.FromTime.TimeOfDay >= t.From.TimeOfDay) && (entity.FromTime.TimeOfDay <= t.To.TimeOfDay))
                )
                );
        }
Exemple #8
0
        public static bool HasVisitTimeConflict(Visit entity)
        {
            EntityModelContainer context = entity.Context;

            return context.Visits.Execute(MergeOption.NoTracking).Any(v => v.Id!= entity.Id && v.ToTime.Date == entity.ToTime.Date &&
                (
                    (entity.ToTime > v.FromTime) && (entity.ToTime < v.ToTime)
                    ||
                    (v.ToTime > entity.FromTime) && (v.ToTime < entity.ToTime)
                )

                && v.EmployeeId==entity.EmployeeId
                );
        }
Exemple #9
0
        public static bool HasHolidayTimeConflict(Visit entity)
        {
            EntityModelContainer context = entity.Context;

            return context.Holidays.Execute(MergeOption.NoTracking).Any(h => h.Date.Date == entity.ToTime.Date);
        }
        public static bool Validate(Visit entity)
        {
            if (entity == null)
                return false;

            if (entity.Patient == null)
            {
                Methods.ShowStandardMsgBox(FormMessageType.Error, RscError.ValidationTitle, RscError.VisitPatientNull);
                return false;
            }

            else if (entity.Doctor == null)
            {
                Methods.ShowStandardMsgBox(FormMessageType.Error, RscError.ValidationTitle, RscError.VisitDoctorNull);
                return false;
            }
            else if (entity.ToTime < entity.FromTime)
            {
                Methods.ShowStandardMsgBox(FormMessageType.Error, RscError.ValidationTitle, RscError.VisitToTimeLess);
                return false;
            }
            else if (entity.FromTime < DateTime.Parse("2010/8/22") || entity.ToTime > DateTime.Parse("2020/8/22"))
            {
                Methods.ShowStandardMsgBox(FormMessageType.Error, RscError.ValidationTitle, RscError.VisitTimeRange);
                return false;
            }

            return true;
        }
 /// <summary>
 /// Create a new Visit object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="fromTime">Initial value of the FromTime property.</param>
 /// <param name="toTime">Initial value of the ToTime property.</param>
 /// <param name="patientId">Initial value of the PatientId property.</param>
 /// <param name="employeeId">Initial value of the EmployeeId property.</param>
 /// <param name="reminderSent">Initial value of the ReminderSent property.</param>
 /// <param name="finalSumCost">Initial value of the FinalSumCost property.</param>
 public static Visit CreateVisit(global::System.Int32 id, global::System.DateTime fromTime, global::System.DateTime toTime, global::System.Int32 patientId, global::System.Int32 employeeId, global::System.Boolean reminderSent, global::System.Double finalSumCost)
 {
     Visit visit = new Visit();
     visit.Id = id;
     visit.FromTime = fromTime;
     visit.ToTime = toTime;
     visit.PatientId = patientId;
     visit.EmployeeId = employeeId;
     visit.ReminderSent = reminderSent;
     visit.FinalSumCost = finalSumCost;
     return visit;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Visits EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVisits(Visit visit)
 {
     base.AddObject("Visits", visit);
 }