private void Grid_patient_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            this.Close();
            int           PatientId        = Convert.ToInt32(Grid_patient.Rows[e.RowIndex].Cells["PatientID"].FormattedValue);
            int           RadioButtonValue = Convert.ToInt32(Grid_patient.Rows[e.RowIndex].Cells["Gender"].FormattedValue);
            string        BirthDate        = (Grid_patient.Rows[e.RowIndex].Cells["DOB"].FormattedValue).ToString();
            int           BloodGroup       = Convert.ToInt32(Grid_patient.Rows[e.RowIndex].Cells["BloodGroup"].FormattedValue);
            AddNewPatient Patient          = new AddNewPatient();

            Patient.EditedPatient = PatientId;

            HelpClass.VisibleOrNot(false, Patient.Controls["But_AddPatient"]);
            HelpClass.VisibleOrNot(true, Patient.Controls["But_EditPatient"]);

            Patient.Text = "تعديل بيانات مريض";
            Patient.Controls["label8"].Text          = "تعديل بيانات مريض";
            Patient.Controls["Txt_PatientName"].Text = (Grid_patient.Rows[e.RowIndex].Cells["PatientName"].FormattedValue).ToString();
            Patient.Controls["Txt_SoSeNo"].Text      = (Grid_patient.Rows[e.RowIndex].Cells["SoSecNo"].FormattedValue).ToString();
            Patient.Controls["Txt_Mobile"].Text      = (Grid_patient.Rows[e.RowIndex].Cells["PhoneNumber"].FormattedValue).ToString();
            Patient.Controls["Txt_Address"].Text     = (Grid_patient.Rows[e.RowIndex].Cells["Address"].FormattedValue).ToString();
            Patient.SetRadioButton(RadioButtonValue);
            Patient.SetBirthDay(BirthDate);
            Patient.Show();
            Patient.SetBloodCombo(BloodGroup);
            Patient.WindowState = FormWindowState.Normal;
            Patient.TopMost     = true;
        }
Exemple #2
0
        private void But_Save_Click(object sender, EventArgs e)
        {
            IdList.Clear();
            foreach (var item in AddNewPrescription.Value)
            {
                var IdX = (from H in Hospital.Drugs
                           where H.DrugName == item
                           select new { H.DrugId }.DrugId).ToList();
                int Id = IdX[0];
                IdList.Add(Id);
            }
            HelpClass.VisibleOrNot(true, But_send);
            But_send.Location = new Point(192, YDrug + 70);
            HelpClass.EnabledOrDisabled(false, But_Save);

            for (int i = 6; i < Controls.Count; i += 3)
            {
                if (!string.IsNullOrEmpty(Controls[i].Text) && !string.IsNullOrEmpty(Controls[(i + 1)].Text) && Controls[i].Text != "0")


                {
                    X.Direction = ParameterDirection.ReturnValue;
                    int ValidQuant;
                    if (int.TryParse(Controls[i].Text, out ValidQuant))
                    {
                        QntyLis.Add(Convert.ToInt32(Controls[i].Text));
                        DoseList.Add(Controls[i + 1].Text);
                    }
                    else
                    {
                        But_send.Visible = false;
                        MessageBox.Show("يرجى إدخال الكمية بشكل صحيح");
                        But_Save.Enabled = true;
                        QntyLis.Clear();
                        DoseList.Clear();
                        break;
                    }
                }
                else
                {
                    But_send.Visible = false;
                    MessageBox.Show("يرجى استكمال بيانات الروشته مع التأكد بعدم وجود كمية تساوي صفر");
                    But_Save.Enabled = true;
                    QntyLis.Clear();
                    DoseList.Clear();
                    break;
                }
            }
        }
Exemple #3
0
        private void But_CheckOut_MouseHover(object sender, EventArgs e)
        {
            HelpClass.VisibleOrNot(true, label7, label9, label8, label10);
            ConnectionClass.SQLCommandWithoutParameters("select publicSchema.CalculateHostingFees (" + ReservationId + ")", CommandType.Text, ExecuteReaderOrNonQuery.executeScalar);
            int     HostingamountDue = ConnectionClass.scalarReturn;
            decimal SumPrescription;

            try
            {
                SumPrescription = (from H in Hospital.VW_Prescription
                                   where H.ReservationID == ReservationId && H.IsReceived == true
                                   select H.Qnty * H.PricePerUnit).Sum();
            }
            catch { SumPrescription = 0; }
            amountDue    = SumPrescription + HostingamountDue;
            label8.Text  = (amountDue).ToString();
            label10.Text = (amountDue - DSum).ToString();
        }
        private void Com_Room_SelectedIndexChanged(object sender, EventArgs e)
        {
            var RidItem = Com_Room.SelectedItem;

            RId = Convert.ToInt32(RidItem.GetType().GetProperty("RoomId").GetValue(RidItem));
            var Pname = RidItem.GetType().GetProperty("PatientName").GetValue(RidItem);

            var ActiveDoc = (from R in Hospital.Rooms
                             join RS in Hospital.Reservations
                             on R.RoomId equals RS.RoomID
                             join D in Hospital.DocfollowUps
                             on RS.ReservationID equals D.ReservationID
                             join DS in Hospital.Doctors
                             on D.DoctorID equals DS.DoctorId
                             where RS.RoomID == RId && RS.IsActive == true
                             select new { DS.DoctorId, DS.DocName, RS.ReservationID }).ToList();

            Com_Doc.DataSource    = ActiveDoc;
            Com_Doc.ValueMember   = "DoctorId";
            Com_Doc.DisplayMember = "DocName";
            Txt_patient.Text      = Pname.ToString();
            if (Com_Doc.SelectedItem != null)
            {
                var x = (Com_Doc.SelectedItem);
                DocId         = Convert.ToInt32(x.GetType().GetProperty("DoctorId").GetValue(x));
                reservationId = Convert.ToInt32(x.GetType().GetProperty("ReservationID").GetValue(x));
                HelpClass.EnabledOrDisabled(true, But_Add);
                HelpClass.VisibleOrNot(true, Com_Doc);
                HelpClass.VisibleOrNot(false, label1);
                //PatientId= Convert.ToInt32(x.GetType().GetProperty("PatientID").GetValue(x));
            }
            else
            {
                HelpClass.EnabledOrDisabled(false, But_Add);
                label1.Text     = "لا يوجد طبيب مخصص لهذا المريض";
                label1.Location = new Point(160, CHY + 80);
                HelpClass.VisibleOrNot(true, label1);
                HelpClass.VisibleOrNot(false, Com_Doc);
            }
        }
Exemple #5
0
        private void Com_RoomNo_SelectedValueChanged(object sender, EventArgs e)
        {
            HelpClass.VisibleOrNot(false, label7, label9, label8, label10);
            if (fromAnotherForm == 0)
            {
                object S = new object();
                S = Com_RoomNo.SelectedItem;
                x = Convert.ToInt32(S.GetType().GetProperty("RoomId").GetValue(S));
            }
            var PatientName = (from R in Hospital.Reservations
                               join p in Hospital.Patients
                               on R.patientId equals p.PatientID
                               where R.IsActive == true && R.RoomID == x
                               select new { p.PatientName, R.ReservationID, R.ArriveDate, R.RoomID }).ToList();

            PName         = PatientName[0].PatientName.ToString();
            ReservationId = Convert.ToInt32(PatientName[0].ReservationID);
            D             = Convert.ToDateTime(PatientName[0].ArriveDate);
            RoomId        = Convert.ToInt32(PatientName[0].RoomID);
            try
            {
                var sum = (from P in Hospital.Payments
                           where P.ReservationId == ReservationId
                           select P.Amount).Sum();
                Txt_TotalPaid.Text = sum.ToString();

                DSum = sum;
            }
            catch {
                Txt_TotalPaid.Text = "0";
                DSum = 0;
            }

            Txt_Arrival.Text     = D.ToString("ddd, dd- MMM- yyyy");
            Txt_PatientName.Text = PName;
        }