コード例 #1
0
ファイル: ucPatients.cs プロジェクト: jlruatpuia/Clinic
        private void grvT_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            int tid             = Convert.ToInt32(grvT.GetFocusedRowCellValue(colTID));
            TreatmentContext tx = new TreatmentContext();
            Treatments       t  = new Treatments();

            t = tx.GetTreatments(tid);

            lbCMP.Text = t.MainComplain;
            lbEXM.Text = t.Examination;
            try
            {
                string   txt = null;
                string[] med = t.Medicine.Split(',');
                for (int i = 0; i < med.Length; i++)
                {
                    txt += med[i].ToString() + Environment.NewLine;
                }
                txt        = txt.TrimEnd(Environment.NewLine.ToCharArray());
                lbMED.Text = txt;
            }
            catch
            {
                lbMED.Text = t.Medicine;
            }

            lbTMP.Text = t.Treatment;
            lbAMT.Text = "₹ " + t.Amount.ToString();
        }
コード例 #2
0
 public void AddTreatment(Treatment treatment)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Treatments.Add(treatment);
         ctx.SaveChanges();
     }
 }
コード例 #3
0
 public void AddAdmin(Admin admin)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Admins.Add(admin);
         ctx.SaveChanges();
     }
 }
コード例 #4
0
 public void AddVolunteer(Volunteer volunteer)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Volunteers.Add(volunteer);
         ctx.SaveChanges();
     }
 }
コード例 #5
0
 public void AddTeenager(Teenager teenager)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Teenagers.Add(teenager);
         ctx.SaveChanges();
     }
 }
コード例 #6
0
 public void AddMentor(Mentor mentor)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Mentors.Add(mentor);
         ctx.SaveChanges();
     }
 }
コード例 #7
0
 public void AddAppointment(Appointment appointment)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Appointments.Add(appointment);
         ctx.SaveChanges();
     }
 }
コード例 #8
0
 public void RemoveTeenager(Teenager teenager)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Teenagers.Attach(teenager);
         ctx.Teenagers.Remove(teenager);
         ctx.SaveChanges();
     }
 }
コード例 #9
0
 public void RemoveMentor(Mentor mentor)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Mentors.Attach(mentor);
         ctx.Mentors.Find(mentor);
         ctx.SaveChanges();
     }
 }
コード例 #10
0
 public void RemoveAdmin(Admin admin)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Admins.Attach(admin);
         ctx.Admins.Remove(admin);
         ctx.SaveChanges();
     }
 }
コード例 #11
0
 public void RemoveVolunteer(Volunteer volunteer)
 {
     using (var ctx = new TreatmentContext())
     {
         ctx.Volunteers.Attach(volunteer);
         ctx.Volunteers.Remove(volunteer);
         ctx.SaveChanges();
     }
 }
コード例 #12
0
ファイル: ucOverallView.cs プロジェクト: jlruatpuia/Clinic
        TreatmentContext tx; // = new TreatmentContext();

        public ucOverallView()
        {
            InitializeComponent();

            sc = new ServerToClient();
            tx = new TreatmentContext();

            beiFR.EditValue = DateTime.Now;
            beiTO.EditValue = DateTime.Now;

            ShowData();
        }
コード例 #13
0
 public void UpdateAppointment(Appointment appointment)
 {
     using (var context = new TreatmentContext())
     {
         var old = context.Appointments.Find(appointment.AppointmentId);
         old.AppointmentId   = appointment.AppointmentId;
         old.AdminId         = appointment.AdminId;
         old.MentorId        = appointment.MentorId;
         old.TeenagerId      = appointment.TeenagerId;
         old.Conclusion      = appointment.Conclusion;
         old.AppointmentDate = appointment.AppointmentDate;
         context.SaveChanges();
     }
 }
コード例 #14
0
 public void UpdateTeenager(Teenager teenager)
 {
     using (var context = new TreatmentContext())
     {
         var old = context.Teenagers.Find(teenager.TeenagerId);
         old.FirstName   = teenager.FirstName;
         old.LastName    = teenager.LastName;
         old.PhoneNumber = teenager.PhoneNumber;
         old.MailAddress = teenager.MailAddress;
         old.Address     = teenager.Address;
         old.Password    = teenager.Password;
         context.SaveChanges();
     }
 }
コード例 #15
0
 public void UpdateMentor(Mentor mentor)
 {
     using (var context = new TreatmentContext())
     {
         var old = context.Mentors.Find(mentor.MentorId);
         old.FirstName   = mentor.FirstName;
         old.LastName    = mentor.LastName;
         old.PhoneNumber = mentor.PhoneNumber;
         old.MailAddress = mentor.MailAddress;
         old.Address     = mentor.Address;
         old.Password    = mentor.Password;
         old.Area        = mentor.Area;
         context.SaveChanges();
     }
 }
コード例 #16
0
 public void UpdateVolunteer(Volunteer volunteer)
 {
     using (var context = new TreatmentContext())
     {
         var old = context.Volunteers.Find(volunteer.VolunteerId);
         old.FirstName   = volunteer.FirstName;
         old.LastName    = volunteer.LastName;
         old.PhoneNumber = volunteer.PhoneNumber;
         old.MailAddress = volunteer.MailAddress;
         old.Address     = volunteer.Address;
         old.Password    = volunteer.Password;
         old.Area        = volunteer.Area;
         context.SaveChanges();
     }
 }
コード例 #17
0
 public void UpdateTreatment(Treatment treatment)
 {
     using (var context = new TreatmentContext())
     {
         var old = context.Treatments.Find(treatment.TreatmentId);
         old.VolunteerId     = treatment.VolunteerId;
         old.TreatmentId     = treatment.TreatmentId;
         old.TreatmentMethod = treatment.TreatmentMethod;
         old.StartTime       = treatment.StartTime;
         old.TreatDurMin     = treatment.TreatDurMin;
         old.Conclusion      = treatment.Conclusion;
         old.Status          = treatment.Status;
         context.SaveChanges();
     }
 }
コード例 #18
0
 public void UpdateAdmin(Admin admin)
 {
     using (var context = new TreatmentContext())
     {
         var old = context.Admins.Find(admin.AdminId);
         old.FirstName   = admin.FirstName;
         old.LastName    = admin.LastName;
         old.PhoneNumber = admin.PhoneNumber;
         old.MailAddress = admin.MailAddress;
         old.Address     = admin.Address;
         old.Password    = admin.Password;
         old.Area        = admin.Area;
         old.IsMainAdmin = admin.IsMainAdmin;
         context.SaveChanges();
     }
 }
コード例 #19
0
        public List <Appointment> GetAllAppointments(Func <Appointment, bool> predicate = null)
        {
            List <Appointment> result = new List <Appointment>();

            using (var context = new TreatmentContext())
            {
                if (predicate == null)
                {
                    result = context.Appointments.ToList();
                }
                else
                {
                    result = context.Appointments.Where(predicate).ToList();
                }
            }
            return(result);
        }
コード例 #20
0
        public List <Teenager> GetAllTeenagers(Func <Teenager, bool> predicate = null)
        {
            List <Teenager> result = new List <Teenager>();

            using (var context = new TreatmentContext())
            {
                if (predicate == null)
                {
                    result = context.Teenagers.ToList();
                }
                else
                {
                    result = context.Teenagers.Where(predicate).ToList();
                }
            }
            return(result);
        }