//Update Button Control protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); Label lblId = FormView1.FindControl("EditId") as Label; var id = long.Parse(lblId.Text); TextBox txtBoxName = FormView1.FindControl("EditName") as TextBox; var name = txtBoxName.Text; Label txtBoxGender = FormView1.FindControl("EditGender") as Label; var gender = (txtBoxGender.Text.Equals("Male")) ? 1 : 2; TextBox txtBoxDOB = FormView1.FindControl("EditDOB") as TextBox; var dob = Convert.ToDateTime(txtBoxDOB.Text); TextBox txtBoxAddress = FormView1.FindControl("EditAddress") as TextBox; var address = txtBoxAddress.Text; var patient = new Patient() { patientId = id, patientName = name, genderId = gender, dob = dob, address = address }; _dataContext.Patients.Attach(patient); _dataContext.Refresh(RefreshMode.KeepCurrentValues, patient); _dataContext.SubmitChanges(); //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("groupId: " + groupId); //Debug.WriteLine("Name: " + name); //Debug.WriteLine("price: " + price); } }
protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); var editedRowIndex = MedicalServiceList.EditIndex; var lblId = MedicalServiceList.Rows[editedRowIndex].FindControl("EditId") as Label; var txtbGroupId = MedicalServiceList.Rows[editedRowIndex].FindControl("EditGroupId") as TextBox; var txtbName = MedicalServiceList.Rows[editedRowIndex].FindControl("EditName") as TextBox; var txtbPrice = MedicalServiceList.Rows[editedRowIndex].FindControl("editPrice") as TextBox; var id = long.Parse(lblId.Text); var groupdId = GetGroupId(txtbGroupId.Text)[0]; var name = txtbName.Text; var price = decimal.Parse(txtbPrice.Text); var medicalService = new MedicalService() { medicalServiceId = id, medicalServiceGroupId = groupdId, medicalServiceName = name, price = price }; _dataContext.MedicalServices.Attach(medicalService); _dataContext.Refresh(RefreshMode.KeepCurrentValues, medicalService); _dataContext.SubmitChanges(); MedicalServiceList.EditIndex = -1; //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("groupId: " + groupdId); //Debug.WriteLine("Name: " + name); //Debug.WriteLine("price: " + price); } }
//Control Update Process protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); var editedRowIndex = IcdList.EditIndex; var lblId = IcdList.Rows[editedRowIndex].FindControl("EditId") as Label; var txtbGroupId = IcdList.Rows[editedRowIndex].FindControl("EditChapterId") as TextBox; var txtbName = IcdList.Rows[editedRowIndex].FindControl("EditName") as TextBox; var txtbCode = IcdList.Rows[editedRowIndex].FindControl("EditCode") as TextBox; var id = long.Parse(lblId.Text); var groupId = GetGroupId(txtbGroupId.Text)[0]; var name = txtbName.Text; var codeName = txtbCode.Text; var icd = new Icd() { icdId = id, icdChapterId = groupId, icdName = name, icdCode = codeName }; _dataContext.Icds.Attach(icd); _dataContext.Refresh(RefreshMode.KeepCurrentValues, icd); _dataContext.SubmitChanges(); IcdList.EditIndex = -1; //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("groupId: " + groupdId); //Debug.WriteLine("Name: " + name); //Debug.WriteLine("price: " + price); } }
//Control Update Process protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); var editedRowIndex = LabOrderList.EditIndex; var lblId = LabOrderList.Rows[editedRowIndex].FindControl("EditId") as Label; var txtbDName = LabOrderList.Rows[editedRowIndex].FindControl("EditDName") as TextBox; var txtbDate = LabOrderList.Rows[editedRowIndex].FindControl("EditDate") as TextBox; var id = long.Parse(lblId.Text); var doctorId = GetGroupId(txtbDName.Text)[0]; var date = Convert.ToDateTime(txtbDate.Text); var labOrder = new LabOrder() { labOrderId = id, doctorId = doctorId, dateVisit = date }; _dataContext.LabOrders.Attach(labOrder); _dataContext.Refresh(RefreshMode.KeepCurrentValues, labOrder); _dataContext.SubmitChanges(); LabOrderList.EditIndex = -1; //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("DName: " + doctorId); //Debug.WriteLine("Date: " + date); } }
protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); var editedRowIndex = LabOrderDetailList.EditIndex; var lblId = LabOrderDetailList.Rows[editedRowIndex].FindControl("EditId") as Label; var txtbLabOrder = LabOrderDetailList.Rows[editedRowIndex].FindControl("EditLabOrder") as TextBox; var txtbMedicalService = LabOrderDetailList.Rows[editedRowIndex].FindControl("EditMSName") as TextBox; var txtbResult = LabOrderDetailList.Rows[editedRowIndex].FindControl("EditResult") as TextBox; var id = long.Parse(lblId.Text); var labOrder = long.Parse(txtbLabOrder.Text); var medicalService = GetMedicalServiceID(txtbMedicalService.Text)[0]; var result = txtbResult.Text; var labOrderDetails = new LabOrderDetail() { labOrderDetailId = id, labOrderId = labOrder, medicalServiceId = medicalService, labResult = result }; _dataContext.LabOrderDetails.Attach(labOrderDetails); _dataContext.Refresh(RefreshMode.KeepCurrentValues, labOrderDetails); _dataContext.SubmitChanges(); LabOrderDetailList.EditIndex = -1; //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("DName: " + doctorId); //Debug.WriteLine("Date: " + date); } }
//Control Update Process protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); var editedRowIndex = PatientsList.EditIndex; var lblId = PatientsList.Rows[editedRowIndex].FindControl("EditId") as Label; var txtBName = PatientsList.Rows[editedRowIndex].FindControl("EditName") as TextBox; var txtBGender = PatientsList.Rows[editedRowIndex].FindControl("EditGender") as Label; var txtBDob = PatientsList.Rows[editedRowIndex].FindControl("EditDOBTextBox") as TextBox; var txtBAddress = PatientsList.Rows[editedRowIndex].FindControl("EditAddress") as TextBox; var id = long.Parse(lblId.Text); var name = txtBName.Text; var gender = (txtBGender.Text.Equals("Male")) ? 1 : 2; var dob = Convert.ToDateTime(txtBDob.Text); var address = txtBAddress.Text; var patient = new Patient() { patientId = id, patientName = name, genderId = gender, dob = dob, address = address }; _dataContext.Patients.Attach(patient); _dataContext.Refresh(RefreshMode.KeepCurrentValues, patient); _dataContext.SubmitChanges(); PatientsList.EditIndex = -1; //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("name: " + name); //Debug.WriteLine("gender: " + gender); //Debug.WriteLine("dob: " + dob); //Debug.WriteLine("address: " + address); } }
//Control Update Process protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); var editedRowIndex = DrugsList.EditIndex; var lblId = DrugsList.Rows[editedRowIndex].FindControl("EditId") as Label; var txtbGroupId = DrugsList.Rows[editedRowIndex].FindControl("EditGroupId") as TextBox; var txtbName = DrugsList.Rows[editedRowIndex].FindControl("EditName") as TextBox; var txtGenName = DrugsList.Rows[editedRowIndex].FindControl("EditGenericName") as TextBox; var txtUnit = DrugsList.Rows[editedRowIndex].FindControl("EditUnit") as TextBox; var txtPrice = DrugsList.Rows[editedRowIndex].FindControl("EditPrice") as TextBox; var id = long.Parse(lblId.Text); var groupId = GetGroupId(txtbGroupId.Text)[0]; var name = txtbName.Text; var genName = txtGenName.Text; var unit = txtUnit.Text; var price = decimal.Parse(txtPrice.Text); var drug = new Drug() { drugId = id, drugGroupId = groupId, drugName = name, drugGenericName = genName, unit = unit, price = price }; _dataContext.Drugs.Attach(drug); _dataContext.Refresh(RefreshMode.KeepCurrentValues, drug); _dataContext.SubmitChanges(); DrugsList.EditIndex = -1; //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("groupId: " + groupdId); //Debug.WriteLine("Name: " + name); //Debug.WriteLine("price: " + price); } }
//Update Button Control protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); Label lblId = FormView1.FindControl("EditId") as Label; var id = long.Parse(lblId.Text); TextBox txtBoxDName = FormView1.FindControl("EditDName") as TextBox; var doctorId = GetGroupId(txtBoxDName.Text)[0]; TextBox txtBoxDate = FormView1.FindControl("EditDate") as TextBox; var date = Convert.ToDateTime(txtBoxDate.Text); var prescription = new Prescription() { prescriptionId = id, doctorId = doctorId, dateWritten = date }; _dataContext.Prescriptions.Attach(prescription); _dataContext.Refresh(RefreshMode.KeepCurrentValues, prescription); _dataContext.SubmitChanges(); //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("DName: " + doctorId); //Debug.WriteLine("Date: " + date); } }
protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); var editedRowIndex = PrescriptionDetailList.EditIndex; var lblId = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditId") as Label; var txtbPID = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditPID") as TextBox; var txtbDName = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditDName") as TextBox; var txtbQuantity = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditQuantity") as TextBox; var txtbDPD = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditDPD") as TextBox; var txtDescription = PrescriptionDetailList.Rows[editedRowIndex].FindControl("EditInstruction") as TextBox; var id = long.Parse(lblId.Text); var pid = long.Parse(txtbPID.Text); var drug = GetDrugID(txtbDName.Text)[0]; var quantity = Convert.ToInt32(txtbQuantity.Text); var dpd = Convert.ToInt32(txtbDPD.Text); var instruction = txtDescription.Text; var prescriptionDetails = new PrescriptionDetail() { prescriptionDetailId = id, prescriptionId = pid, drugId = drug, quantity = quantity, dosePerDay = dpd, specialInstruction = instruction }; _dataContext.PrescriptionDetails.Attach(prescriptionDetails); _dataContext.Refresh(RefreshMode.KeepCurrentValues, prescriptionDetails); _dataContext.SubmitChanges(); PrescriptionDetailList.EditIndex = -1; //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("DName: " + doctorId); //Debug.WriteLine("Date: " + date); } }
//Update Button Control protected void UpdateButton_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(3000); var idTxt = FormView1.FindControl("EditId") as Label; var hospitalTxt = FormView1.FindControl("EditHospital") as TextBox; var doctorTxt = FormView1.FindControl("EditDoctor") as TextBox; var patientTxt = FormView1.FindControl("EditPatient") as TextBox; var icdTxt = FormView1.FindControl("EditIcd") as TextBox; //var prescriptionTxt = FormView1.FindControl("EditPrescription") as TextBox; //var labOrderTxt = FormView1.FindControl("EditLabOrder") as TextBox; var dateTxt = FormView1.FindControl("EditDate") as TextBox; var outcomeTxt = FormView1.FindControl("EditOutcome") as TextBox; var id = long.Parse(idTxt.Text); var hospital = GetId(hospitalTxt.Text, "hospital")[0]; var doctor = GetId(doctorTxt.Text, "doctor")[0]; var patient = GetId(patientTxt.Text, "patient")[0]; var icd = GetId(icdTxt.Text, "icd")[0]; //var prescription = GetId(prescriptionTxt.Text, "prescription")[0]; //var labOrder = GetId(labOrderTxt.Text, "laborder")[0]; var date = Convert.ToDateTime(dateTxt.Text); var outcome = outcomeTxt.Text; var visit = new Visit() { visitId = id, hospitalId = hospital, doctorId = doctor, patientId = patient, icdId = icd, dateVisit = date, outcome = outcome }; _dataContext.Visits.Attach(visit); _dataContext.Refresh(RefreshMode.KeepCurrentValues, visit); _dataContext.SubmitChanges(); //Use For Debug passed value //Debug.WriteLine("id: " + id); //Debug.WriteLine("groupId: " + groupId); //Debug.WriteLine("Name: " + name); //Debug.WriteLine("price: " + price); } }
//protected void AddVisitButton_Click(object sender, EventArgs e) //{ // Button btn = (Button)sender; // String btnId = btn.ID; // if (btnId.Equals("AddVisitButton")) // { // if (IsValid) // { // System.Threading.Thread.Sleep(3000); // var hospital = GetId(HospitalTxt.Text, "hospital")[0]; // var doctor = GetId(DoctorTxt.Text, "doctor")[0]; // var patient = GetId(PatientTxt.Text, "patient")[0]; // var icd = GetId(ICDTxt.Text, "icd")[0]; // var prescription = GetId(PrescriptionTxt.Text, "prescription")[0]; // var labOrder = GetId(LabOrderTxt.Text, "laborder")[0]; // var date = Convert.ToDateTime(visitedDate.Text); // var outcome = OutcomeTxt.Text; // var visit = new Visit() { hospitalId = hospital, doctorId = doctor, patientId = patient, icdId = icd, prescriptionId = prescription, labOrderId = labOrder, dateVisit = date, outcome = outcome }; // _dataContext.Visits.InsertOnSubmit(visit); // _dataContext.SubmitChanges(); // VisitList.DataBind(); // ResetInputField(); // } // } // else if (btnId.Equals("ResetVisitButton")) // { // ResetInputField(); // } //} protected void UpdateBtn_Click(object sender, EventArgs e) { if (IsValid) { System.Threading.Thread.Sleep(2000); var editedRowIndex = VisitList.EditIndex; var idTxt = VisitList.Rows[editedRowIndex].FindControl("EditId") as Label; var hospitalTxt = VisitList.Rows[editedRowIndex].FindControl("EditHospital") as TextBox; var doctorTxt = VisitList.Rows[editedRowIndex].FindControl("EditDoctor") as TextBox; var patientTxt = VisitList.Rows[editedRowIndex].FindControl("EditPatient") as TextBox; var icdTxt = VisitList.Rows[editedRowIndex].FindControl("EditIcd") as TextBox; var prescriptionTxt = VisitList.Rows[editedRowIndex].FindControl("EditPrescription") as TextBox; var labOrderTxt = VisitList.Rows[editedRowIndex].FindControl("EditLabOrder") as TextBox; var dateTxt = VisitList.Rows[editedRowIndex].FindControl("EditDate") as TextBox; var outcomeTxt = VisitList.Rows[editedRowIndex].FindControl("EditOutcome") as TextBox; var id = long.Parse(idTxt.Text); var hospital = GetId(hospitalTxt.Text, "hospital")[0]; var doctor = GetId(doctorTxt.Text, "doctor")[0]; var patient = GetId(patientTxt.Text, "patient")[0]; var icd = GetId(icdTxt.Text, "icd")[0]; var prescription = GetId(prescriptionTxt.Text, "prescription")[0]; var labOrder = GetId(labOrderTxt.Text, "laborder")[0]; var date = Convert.ToDateTime(dateTxt.Text); var outcome = outcomeTxt.Text; var visit = new Visit() { visitId = id, hospitalId = hospital, doctorId = doctor, patientId = patient, icdId = icd, prescriptionId = prescription, labOrderId = labOrder, dateVisit = date, outcome = outcome }; _dataContext.Visits.Attach(visit); _dataContext.Refresh(RefreshMode.KeepCurrentValues, visit); _dataContext.SubmitChanges(); VisitList.EditIndex = -1; } }