protected void txtAffPhyCode_TextChanged(object sender, EventArgs e) { using (PhysicianBDContext PHdb = new PhysicianBDContext()) { int PhyCode = int.Parse(txtAffPhyCode.Text); var PhysicianData = (from physicion_tbl in PHdb.Physicians where physicion_tbl.PhysicianID == PhyCode select physicion_tbl).FirstOrDefault(); txtAffiliationName.Text = PhysicianData.PhysicianName; } }
protected void btnPhysicianSave_Click(object sender, EventArgs e) { if (txtPhysicianName.Text == "") { lblSaveStatus.Text = "Please Fill a Physician Name"; lblPhReq.Visible = true; } else if (ddlAreaId.SelectedIndex == 0) { lblSaveStatus.Text = "Please Select Area"; lblAreaReq.Visible = true; } else { using (PhysicianBDContext newph = new PhysicianBDContext()) { Physician ph = new Physician(); ph.PhysicianName = txtPhysicianName.Text; ph.TelNumber = txtTelNumber.Text; ph.PhysicianEmailAddress = txtPhysicianEmailAddress.Text; ph.MobileNumber = txtMobileNumber.Text; ph.SpecialtyID = int.Parse(ddlAreaId.SelectedValue); ph.Deleted = null; ph.BirthDate = dpBrithDate.SelectedDate; ph.EntryDate = DateTime.Now; ph.EntryEmployeeID = int.Parse(Session["EmployeeHRCodeFromAdmin"].ToString()); newph.Physicians.Add(ph); int roweffected = newph.SaveChanges(); if (roweffected > 0) { lblSaveStatus.Text = "Saved"; lblPhReq.Visible = false; lblAreaReq.Visible = false; clearFields(); } else { lblSaveStatus.Text = "Error"; } } } using (PhysicianViewDBContext db = new PhysicianViewDBContext()) { int maxphy = db.View_Physicians.Max(ph => ph.PhysicianID); var alldata = from physicion_tbl in db.View_Physicians where physicion_tbl.Deleted == null && physicion_tbl.PhysicianID == maxphy select physicion_tbl; GridView1.DataSource = alldata.ToList(); GridView1.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { using (PhysicianBDContext PHdb = new PhysicianBDContext()) { if (txtPhusicianSe.Text != "" & rbPhyName.Checked == true) { var PhysicianData = (from physicion_tbl in PHdb.Physicians where physicion_tbl.PhysicianName.Contains(txtPhusicianSe.Text) select physicion_tbl).ToList(); ddlPhysicianIDSe.DataValueField = "PhysicianID"; ddlPhysicianIDSe.DataTextField = "PhysicianName"; ddlPhysicianIDSe.DataSource = PhysicianData; ddlPhysicianIDSe.DataBind(); } else if (txtPhusicianSe.Text != "" & rbPhyCode.Checked == true) { int PhyCode = int.Parse(txtPhusicianSe.Text); var PhysicianData = (from physicion_tbl in PHdb.Physicians where physicion_tbl.PhysicianID == PhyCode select physicion_tbl).ToList(); ddlPhysicianIDSe.DataValueField = "PhysicianID"; ddlPhysicianIDSe.DataTextField = "PhysicianName"; ddlPhysicianIDSe.DataSource = PhysicianData; ddlPhysicianIDSe.DataBind(); } } }
protected void btnSave_Click(object sender, EventArgs e) { using (AffiliationTempDBContext newAff = new AffiliationTempDBContext()) { AffiliationsTemp Aff = new AffiliationsTemp(); using (PhysicianBDContext PHdb = new PhysicianBDContext()) { int PhyCode = int.Parse(txtAffPhyCode.Text); var PhysicianData = (from physicion_tbl in PHdb.Physicians where physicion_tbl.PhysicianID == PhyCode select physicion_tbl).FirstOrDefault(); txtAffiliationName.Text = PhysicianData.PhysicianName; txtSpCode.Text = (PhysicianData.SpecialtyID).ToString(); } Aff.AffiliationName = txtAffiliationName.Text; Aff.PhysicianID = int.Parse(txtAffPhyCode.Text); Aff.EntityID = int.Parse(txtAffClinicCode.Text); Aff.BestTimeFrom = txtBestTimeFrom.Text; Aff.BestTimeTo = txtBestTimeTo.Text; Aff.Notes = txtNotes.Text; Aff.New = true; Aff.Status = false; Aff.Deleted = false; Aff.EntryEmployeeID = int.Parse(Session["EmployeeHRCodeFromAdmin"].ToString()); Aff.EntryDate = DateTime.Now; newAff.AffiliationsTemps.Add(Aff); int roweffected = newAff.SaveChanges(); if (roweffected > 0) { affiliationslblSaveStatus.Text = "Saved"; using (AffiliationTempDBContext db = new AffiliationTempDBContext()) { int maxent = db.AffiliationsTemps.Max(en => en.ID); txtAffID.Text = maxent.ToString(); } } else { affiliationslblSaveStatus.Text = "Error"; } } using (PhysiciansValueTempDBContext newPhVal = new PhysiciansValueTempDBContext()) { int spcode = int.Parse(txtSpCode.Text); PhysicianValueByLineTemp PhyVal = new PhysicianValueByLineTemp(); for (int i = 1; i <= 7; i++) { PhyVal.AffiliationID = int.Parse(txtAffID.Text); PhyVal.LineID = i; if (i == 1) { PhyVal.PrescriptionHappit = Double.Parse(ddlLine1.SelectedValue); PhyVal.NoOfPatients = Double.Parse(ddlNoPatients1.SelectedValue); PhyVal.WaitingTime = Double.Parse(ddlWT1.SelectedValue); } if (i == 2) { PhyVal.PrescriptionHappit = Double.Parse(ddlLine2.SelectedValue); PhyVal.NoOfPatients = Double.Parse(ddlNoPatients2.SelectedValue); PhyVal.WaitingTime = Double.Parse(ddlWT2.SelectedValue); } if (i == 3) { PhyVal.PrescriptionHappit = Double.Parse(ddlLine3.SelectedValue); PhyVal.NoOfPatients = Double.Parse(ddlNoPatients3.SelectedValue); PhyVal.WaitingTime = Double.Parse(ddlWT3.SelectedValue); } if (i == 4) { PhyVal.PrescriptionHappit = Double.Parse(ddlLine4.SelectedValue); PhyVal.NoOfPatients = Double.Parse(ddlNoPatients4.SelectedValue); PhyVal.WaitingTime = Double.Parse(ddlWT4.SelectedValue); } if (i == 5) { PhyVal.PrescriptionHappit = Double.Parse(ddlLine5.SelectedValue); PhyVal.NoOfPatients = Double.Parse(ddlNoPatients5.SelectedValue); PhyVal.WaitingTime = Double.Parse(ddlWT5.SelectedValue); } if (i == 6) { PhyVal.PrescriptionHappit = Double.Parse(ddlLine6.SelectedValue); PhyVal.NoOfPatients = Double.Parse(ddlNoPatients6.SelectedValue); PhyVal.WaitingTime = Double.Parse(ddlWT6.SelectedValue); } if (i == 7) { PhyVal.PrescriptionHappit = Double.Parse(ddlLine7.SelectedValue); PhyVal.NoOfPatients = Double.Parse(ddlNoPatients7.SelectedValue); PhyVal.WaitingTime = Double.Parse(ddlWT7.SelectedValue); } using (SpecialtyPriorityDBContext SVdb = new SpecialtyPriorityDBContext()) { var SVData = (from SV_tbl in SVdb.SpecPriorityByLines where SV_tbl.LineID == i && SV_tbl.SpecialtyID == spcode select SV_tbl).FirstOrDefault(); PhyVal.SpecialtyValue = SVData.SpecValue / 10; } PhyVal.TotalValue = PhyVal.SpecialtyValue + PhyVal.PrescriptionHappit + PhyVal.NoOfPatients; if (PhyVal.TotalValue >= 8) { PhyVal.PhysicianClass = "A+"; } if (PhyVal.TotalValue < 8) { if (PhyVal.TotalValue >= 4.5) { PhyVal.PhysicianClass = "A"; } if (PhyVal.TotalValue < 4.5) { PhyVal.PhysicianClass = "C"; } } PhyVal.LastModifierID = int.Parse(Session["EmployeeHRCodeFromAdmin"].ToString()); PhyVal.CreateDate = DateTime.Now; PhyVal.CreatorID = int.Parse(Session["EmployeeHRCodeFromAdmin"].ToString()); PhyVal.LastModificationDate = DateTime.Now; PhyVal.New = true; PhyVal.Deleted = false; PhyVal.Status = false; newPhVal.PhysicianValueByLineTemps.Add(PhyVal); int roweffected = newPhVal.SaveChanges(); if (roweffected > 0) { affiliationslblSaveStatus.Text = "Saved"; } else { affiliationslblSaveStatus.Text = "Error"; } } } }