public DataTable get_DrugInfo(PatientPersonalDetails Pat_Det) { objNLog.Info("Function Started with Pat_Det as argument..."); SqlConnection sqlCon = new SqlConnection(conStr); DataSet ds = new DataSet(); bool successFlag = false; try { string sqlQry = "sp_getDrugInfo"; SqlCommand cmd = new SqlCommand(sqlQry); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = sqlCon; SqlParameter par_RxID = cmd.Parameters.Add("@Pat_ID", SqlDbType.Int); par_RxID.Value = Pat_Det.Pat_ID; SqlDataAdapter sqlDa = new SqlDataAdapter(cmd); sqlDa.Fill(ds, "Pat_DrugInfo"); successFlag = true; } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Retrieving Patient Drug Info.", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Retrieving Patient Drug Info.", ex); } finally { objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); return ds.Tables["Pat_DrugInfo"]; }
public void update_patInfo(string userID,PatientPersonalDetails Pat_Info, PatientName Pat_Name) { objNLog.Info("Function Started with Pat_Info, Pat_Name as argument..."); bool successFlag = false; SqlConnection sqlCon = new SqlConnection(conStr); try { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_update_PatientInfo"; cmd.Connection = sqlCon; SqlParameter sql_FacId = cmd.Parameters.Add("@FacId", SqlDbType.Int); sql_FacId.Value = Pat_Info.FacID; SqlParameter sql_PatMRN = cmd.Parameters.Add("@Pat_MRN", SqlDbType.VarChar,15); sql_PatMRN.Value = Pat_Info.MRN; SqlParameter sql_PatFname = cmd.Parameters.Add("@Pat_Fname", SqlDbType.VarChar, 50); sql_PatFname.Value = Pat_Name.FirstName; SqlParameter sql_PatMname = cmd.Parameters.Add("@Pat_Mname", SqlDbType.VarChar, 50); sql_PatMname.Value = Pat_Name.MiddleName; SqlParameter sql_PatLname = cmd.Parameters.Add("@Pat_Lname", SqlDbType.VarChar, 50); sql_PatLname.Value = Pat_Name.LastName; SqlParameter sql_PatGender = cmd.Parameters.Add("@Pat_Gender", SqlDbType.Char, 1); sql_PatGender.Value = Pat_Info.Gender; SqlParameter sql_PatDob = cmd.Parameters.Add("@Pat_DOB", SqlDbType.DateTime2, 7); sql_PatDob.Value = Convert.ToDateTime(Pat_Info.DOB); SqlParameter sql_PatSSN = cmd.Parameters.Add("@Pat_SSN", SqlDbType.VarChar, 16); sql_PatSSN.Value = Pat_Info.SSN; SqlParameter sql_PatAdd1 = cmd.Parameters.Add("@Pat_Address1", SqlDbType.VarChar, 50); sql_PatAdd1.Value = Pat_Info.PatientAddress1; SqlParameter sql_PatAdd2 = cmd.Parameters.Add("@Pat_Address2", SqlDbType.VarChar, 50); sql_PatAdd2.Value = Pat_Info.PatientAddress2; SqlParameter sql_PatCity = cmd.Parameters.Add("@Pat_City", SqlDbType.VarChar, 50); sql_PatCity.Value = Pat_Info.Pat_City ; SqlParameter sql_PatState = cmd.Parameters.Add("@Pat_State", SqlDbType.VarChar, 14); sql_PatState.Value = Pat_Info.Pat_state; SqlParameter sql_PatZip = cmd.Parameters.Add("@Pat_Zip", SqlDbType.VarChar, 10); sql_PatZip.Value = Pat_Info.Pat_ZIP; SqlParameter sql_PatSAdd1 = cmd.Parameters.Add("@Pat_SAddress1", SqlDbType.VarChar, 50); sql_PatSAdd1.Value = Pat_Info.PatientShipAddress1; SqlParameter sql_PatSAdd2 = cmd.Parameters.Add("@Pat_SAddress2", SqlDbType.VarChar, 50); sql_PatSAdd2.Value = Pat_Info.PatientShipAddress2; SqlParameter sql_PatSCity = cmd.Parameters.Add("@Pat_SCity", SqlDbType.VarChar, 50); sql_PatSCity.Value = Pat_Info.Pat_SCity; SqlParameter sql_PatSState = cmd.Parameters.Add("@Pat_SState", SqlDbType.VarChar, 14); sql_PatSState.Value = Pat_Info.Pat_Sstate; SqlParameter sql_PatSZip = cmd.Parameters.Add("@Pat_SZip", SqlDbType.VarChar, 10); sql_PatSZip.Value = Pat_Info.Pat_SZIP; SqlParameter sql_PatPhone = cmd.Parameters.Add("@Pat_Phone", SqlDbType.VarChar, 16); sql_PatPhone.Value = Pat_Info.Pat_Phone;//@Pat_WPhone SqlParameter sql_PatCPhone = cmd.Parameters.Add("@Pat_CPhone", SqlDbType.VarChar, 16); sql_PatCPhone.Value = Pat_Info.Pat_CellPhone; SqlParameter sql_PatWPhone = cmd.Parameters.Add("@Pat_WPhone", SqlDbType.VarChar, 16); sql_PatWPhone.Value = Pat_Info.Pat_WPhone; SqlParameter sql_patDoc = cmd.Parameters.Add("@Pat_PDoc", SqlDbType.VarChar, 50); sql_patDoc.Value = Pat_Info.Pat_Pre_Doc; SqlParameter sql_AutoFill = cmd.Parameters.Add("@AutoFill", SqlDbType.Char, 1); sql_AutoFill.Value = Pat_Info.Pat_AutoFill; SqlParameter sql_DocId = cmd.Parameters.Add("@DocId", SqlDbType.Int); sql_DocId.Value = Pat_Info.DocID; SqlParameter sql_PatPrmIns = cmd.Parameters.Add("@Pat_PrimInsu_ID", SqlDbType.Int); if(Pat_Info.PrimaryInsID!=0) sql_PatPrmIns.Value = Pat_Info.PrimaryInsID; SqlParameter par_DiagnnosisCode = cmd.Parameters.Add("@DiagnnosisCode", SqlDbType.VarChar, 255); par_DiagnnosisCode.Value = Pat_Info.Pat_Diagnosis; SqlParameter par_Patid = cmd.Parameters.Add("@Pat_ID", SqlDbType.Int); if (Pat_Info.Pat_ID != null) par_Patid.Value = Pat_Info.Pat_ID; //SqlParameter sql_Pharmacy = cmd.Parameters.Add("@Pharmacy", SqlDbType.VarChar, 255); //sql_Pharmacy.Value = Pat_Info.PhacyName; SqlParameter sql_userid = cmd.Parameters.Add("@UserID", SqlDbType.VarChar, 20); sql_userid.Value = userID; SqlParameter sql_HIPPA_Notice = cmd.Parameters.Add("@HIPPA", SqlDbType.Char, 1); sql_HIPPA_Notice.Value = Pat_Info.HIPPANotice ; SqlParameter sql_HIPPA_Date = cmd.Parameters.Add("@HIPPADate", SqlDbType.Date , 7); if(Pat_Info.HIPPANotice=="Y") sql_HIPPA_Date.Value = Pat_Info.HIPPADate; SqlParameter sql_ecFNAME = cmd.Parameters.Add("@ecFNAME", SqlDbType.VarChar, 20); sql_ecFNAME.Value = Pat_Info.eContactFName; SqlParameter sql_ecLNAME = cmd.Parameters.Add("@ecLNAME", SqlDbType.VarChar, 20); sql_ecLNAME.Value = Pat_Info.eContactLName; SqlParameter sql_ecPHONE = cmd.Parameters.Add("@ecPHONE", SqlDbType.VarChar, 50); sql_ecPHONE.Value = Pat_Info.eContactPhone; SqlParameter sql_ecREL = cmd.Parameters.Add("@ecREL", SqlDbType.Char, 1); sql_ecREL.Value = Pat_Info.eContactRelation; SqlParameter sql_IsActive = cmd.Parameters.Add("@Pat_Status", SqlDbType.Char, 1); sql_IsActive.Value = Pat_Info.PatientStatus; sqlCon.Open(); cmd.ExecuteNonQuery(); successFlag = true; objUALog.LogUserActivity(conStr, userID, "Updated Patient Profile Info. with PatID = " + Pat_Info.Pat_ID.ToString(), "Patient_Info", Pat_Info.Pat_ID ); } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Updating Patient Info.", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Updating Patient Info.", ex); } finally { sqlCon.Close(); objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); }
public DataRow get_DoctorNames(PatientPersonalDetails DocFullName) { objNLog.Info("Function Started with DocFullName as argument..."); DataTable doc_names = new DataTable(); SqlConnection sqlCon = new SqlConnection(conStr); DataSet dsdocnames = new DataSet(); bool successFlag = false; try { string sqlQuery = "select Doc_FName,Doc_LName,Doc_ID from Doctor_Info where Status<>'N' and Doc_FullName like '%" + DocFullName.DocFullName + "%'"; //objNLog.Error("DocQuery3 : " + sqlQuery); SqlDataAdapter sqlDa = new SqlDataAdapter(sqlQuery, sqlCon); sqlDa.Fill(dsdocnames, "Doc_Name"); successFlag = true; } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Retrieving Doctor Names.", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Retrieving Doctor Names.", ex); } finally { objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); return dsdocnames.Tables["Doc_Name"].Rows[0]; }
public DataTable get_PatientNote(PatientPersonalDetails pat_Info) { objNLog.Info("Function Started with pat_Info as arguments..."); bool successFlag = false; SqlConnection sqlCon = new SqlConnection(conStr); string sqlQuery = "select Note_ID,Note_Description,Note_Date,Note_By from Pat_Rx_Notes where pat_ID=" + pat_Info.Pat_ID + " Order By Note_Date Desc"; //SqlCommand sqlCmd = new SqlCommand(sqlQuery, sql); SqlCommand cmd = new SqlCommand("sp_get_PatientNotes", sqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter par_pat_ID = cmd.Parameters.Add("@Pat_Id", SqlDbType.Int); par_pat_ID.Value = pat_Info.Pat_ID; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet dsPatient = new DataSet(); try { da.Fill(dsPatient, "pat_Note"); successFlag = true; } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Retrieving Patient Notes.", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Retrieving Patient Notes.", ex); } finally { sqlCon.Close(); objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); return dsPatient.Tables["pat_Note"]; }
//Gets Patient InsuranceInfo public DataTable get_PatientPaymentInfo(PatientPersonalDetails Pat_med) { objNLog.Info("Function Started with Pat_med as argument..."); SqlConnection sqlCon = new SqlConnection(conStr); bool successFlag = false; DataSet dsPatAllergies = new DataSet(); try { SqlCommand sqlCmd = new SqlCommand("sp_getPayments", sqlCon); sqlCmd.CommandType = CommandType.StoredProcedure; SqlParameter Par_patId = sqlCmd.Parameters.Add("@Pat_ID", SqlDbType.Int); Par_patId.Value = Pat_med.Pat_ID; SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd); sqlDa.Fill(dsPatAllergies, "PatPayments"); successFlag = true; } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " ", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Retrieving Patient Payment Info.", ex); } finally { sqlCon.Close(); objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); return dsPatAllergies.Tables["PatPayments"]; }
protected void ShowPatientAllergies(int patID) { objNLog.Info("Function Started..."); try { lblPatAllergies1.Text = ""; objPat_Pat_Det = new PatientPersonalDetails(); objPat_Pat_Det.Pat_ID = patID; DataTable dtPatAllergies = objPat_Info.get_PatientAllergies(objPat_Pat_Det); if (dtPatAllergies.Rows.Count > 0) { for(int i=0;i<dtPatAllergies.Rows.Count;i++) { if(lblPatAllergies1.Text=="") lblPatAllergies1.Text = dtPatAllergies.Rows[i]["Pat_Allergic_To"].ToString(); else lblPatAllergies1.Text = lblPatAllergies1.Text + ", " + dtPatAllergies.Rows[i]["Pat_Allergic_To"].ToString(); } } } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } objNLog.Info("Function Completed..."); }
public DataTable get_PatientDocuments(PatientPersonalDetails pat_Info) { objNLog.Info("Function Started with pat_Info as argument..."); SqlConnection sqlCon = new SqlConnection(conStr); DataSet dsPatient = new DataSet(); bool successFlag = false; try { string sqlQuery = "select Pat_Doc_ID,Doc_Name,Doc_Desc,FileName,'Documents/' + Convert(varchar,Pat_Doc_ID,0) + '_' + FileName as hLink from Pat_Documents where pat_ID=" + pat_Info.Pat_ID + " Order By Pat_Doc_ID Desc"; SqlDataAdapter da = new SqlDataAdapter(sqlQuery, sqlCon); da.Fill(dsPatient, "pat_Doc"); successFlag = true; } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Retrieving Patient Documnet. ", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Deleting Patient Documnet.", ex); } finally { sqlCon.Close(); objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); return dsPatient.Tables["pat_Doc"]; }
protected void FillgridPatPayments() { objNLog.Info("Function Started..."); try { if (hidPatID.Value.ToString() != "") { objPat_Pat_Det = new PatientPersonalDetails(); objPat_Pat_Det.Pat_ID = int.Parse(hidPatID.Value.ToString()); gridPayments.DataSource = objPat_Info.get_PatientPaymentInfo(objPat_Pat_Det); gridPayments.DataBind(); } } catch (Exception ex) { objNLog.Error("Error : " + ex.Message ); } objNLog.Info("Function Completed..."); }
protected void FillgridPriscrition() { objNLog.Info("Function Started..."); try { if (lblDOB1.Text == "" || lblGender1.Text == "") { btnAddPresc.Enabled = false; btnAddAllergy.Enabled = false; btnAddCallLog.Enabled = false; btnAddPayments.Enabled = false; btnAddMed1.Enabled = false; btnAddIns.Enabled = false; btnAddDoc.Enabled = false; } else { btnAddPresc.Enabled = true; btnAddAllergy.Enabled = true; btnAddCallLog.Enabled = true; btnAddPayments.Enabled = true; btnAddMed1.Enabled = true; btnAddIns.Enabled = true; btnAddDoc.Enabled = true; } if (hidPatID.Value.ToString() != "") { objPat_Pat_Det = new PatientPersonalDetails(); objPat_Pat_Det.Pat_ID = int.Parse(hidPatID.Value.ToString()); gridPrisInfo.DataSource = objPat_Info.get_DrugInfo(objPat_Pat_Det); gridPrisInfo.DataBind(); } } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } objNLog.Info("Function completed..."); }
protected void FillgridPatMedInfo() { objNLog.Info("Function Started..."); try { if (hidPatID.Value.ToString() != "") { objPat_Pat_Det = new PatientPersonalDetails(); objPat_Pat_Det.Pat_ID = int.Parse(hidPatID.Value.ToString()); gridPatMedicalInfo.DataSource = objPat_Info.get_PatientMedHistory(objPat_Pat_Det); gridPatMedicalInfo.DataBind(); btnAddMed1.Attributes.Add("style", "visibility:show"); } } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } objNLog.Info("Function Completed..."); }
protected void FillgridPatCallLog() { objNLog.Info("Function Started..."); try { if (hidPatID.Value.ToString() != "") { objPat_Pat_Det = new PatientPersonalDetails(); objPat_Pat_Det.Pat_ID = int.Parse(hidPatID.Value.ToString()); gridCallog.DataSource = objPat_Info.get_PatientCallLogInfo(objPat_Pat_Det); gridCallog.DataBind(); } lblCallLogReceiver.Visible = false; lblCallLogReceiver.Text = ""; rbtnMedicalIssueC.Checked = true; rbtnMedicalIssueA.Checked = false; rbtnMedicalIssueN.Checked = false; rbtnMedicalIssueD.Checked = false; rbtnMedicalIssueP.Checked = false; rbtnMedicalIssuePA.Checked = false; txtCallLogDoctor.Text = lblDoctor1.Text; txtCallLogPharmacist.Text = ""; txtCallLogPharmacist.Visible = false; txtCallLogDoctor.Visible = false; txtCallLogOther.Text = ""; txtCallLogOther.Visible = false; } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } objNLog.Info("Function Started..."); }
protected void FillgridPatInsurance() { objNLog.Info("Function Started.."); try { if (hidPat_ID.Value != "") { Pat_Det = new PatientPersonalDetails(); Pat_Det.Pat_ID = int.Parse(hidPat_ID.Value); gridPatInsurance.DataSource = Pat_Info.get_PatientInsuranceInfo(Pat_Det); gridPatInsurance.DataBind(); } } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); } objNLog.Info("Function Completed.."); }
protected void btnUpdate_Click(object sender, ImageClickEventArgs e) { objNLog.Info("Event Started.."); //if (lblStatus.Visible == true) // lblStatus.Visible = false; PatientPersonalDetails Pat_Det = new PatientPersonalDetails(); PatientInfoDAL Pat_Info = new PatientInfoDAL(); try { PatientName Pat_Name = new PatientName(); int facID=Pat_Info.Get_FacID(txtClinicFacility.Text); if (facID == 0) { Pat_Det.FacID = 0; } else { Pat_Det.FacID = facID; } Pat_Det.MRN = txtMRN.Text; Pat_Name.FirstName = txtPatientFName.Text; Pat_Name.LastName = txtPatientLName.Text; Pat_Name.MiddleName = txtPatientMName.Text; if (rbtnMale.Checked == true) { Pat_Det.Gender = "M"; } else { Pat_Det.Gender = "F"; } Pat_Det.DOB = txtDOB.Text; Pat_Det.SSN = txtSSN.Text; Pat_Det.eContactFName = txtecontactFNAME.Text.Trim(); Pat_Det.eContactLName = txtecontactLNAME.Text.Trim(); Pat_Det.eContactPhone = txtecontactPHONE.Text.Trim(); if (ddlecontactREL.SelectedValue != "0") Pat_Det.eContactRelation = ddlecontactREL.SelectedValue; Pat_Det.PatientAddress1 = txtAddress1.Text; Pat_Det.PatientAddress2 = txtAddress2.Text; Pat_Det.Pat_City = txtCity.Text; Pat_Det.Pat_state = txtState.Text; Pat_Det.Pat_ZIP = txtZip.Text; Pat_Det.PatientShipAddress1 = txtSAddr1.Text; Pat_Det.PatientShipAddress2 = txtSAddr2.Text; Pat_Det.Pat_SCity = txtSCity1.Text; Pat_Det.Pat_Sstate = txtSState.Text; Pat_Det.Pat_SZIP = txtSZIP.Text; Pat_Det.Pat_Phone = txtPhone.Text; Pat_Det.Pat_WPhone = txtWorkPhone.Text; Pat_Det.Pat_CellPhone = txtCellPhone.Text; string diag_Code = ""; if (txtDiagn1.Text.Trim() != "") diag_Code = txtDiagn1.Text.Trim(); if (txtDiagn2.Text.Trim() != "") { if (diag_Code.Trim() != "") diag_Code = diag_Code + "," + txtDiagn2.Text.Trim(); else diag_Code = diag_Code + txtDiagn2.Text.Trim(); } if (txtDiagn3.Text.Trim() != "") { if (diag_Code.Trim() != "") diag_Code = diag_Code + "," + txtDiagn3.Text.Trim(); else diag_Code = diag_Code + txtDiagn3.Text.Trim(); } if (txtDiagn4.Text.Trim() != "") { if (diag_Code.Trim() != "") diag_Code = diag_Code + "," + txtDiagn4.Text.Trim(); else diag_Code = diag_Code + txtDiagn4.Text.Trim(); } if (txtDiagn5.Text.Trim() != "") { if (diag_Code.Trim() != "") diag_Code = diag_Code + "," + txtDiagn5.Text.Trim(); else diag_Code = diag_Code + txtDiagn5.Text.Trim(); } Pat_Det.Pat_Diagnosis = diag_Code; Pat_Det.Pat_Pre_Doc = txtDoctor.Text; Pat_Det.DocID = Int32.Parse(Pat_Info.Get_DocID(txtDoctor.Text).ToString()); if (chkAutoreFillOption.Checked) Pat_Det.Pat_AutoFill = "Y"; else Pat_Det.Pat_AutoFill = "N"; if (chkHippa.Checked) { Pat_Det.HIPPANotice = "Y"; Pat_Det.HIPPADate = txtHippaDate.Text; } else Pat_Det.HIPPANotice = "N"; Pat_Det.Pat_ID = int.Parse(hidPat_ID.Value.ToString()); if (ddlPrimInsurance.Enabled == true ) Pat_Det.PrimaryInsID = int.Parse(ddlPrimInsurance.SelectedValue.ToString()); if (ddlPatStatus.Enabled == true) Pat_Det.PatientStatus = char.Parse(ddlPatStatus.SelectedValue); string userID = (string)Session["User"]; if (Pat_Det.FacID == 0) { //lblStatus.Visible=true; //lblStatus.Text = "No Facilities Found / Invalid Facility..!"; divPatWarning.Visible = true; divPatError.Visible = false; divPatSuccess.Visible = false; lblAddPatientStatus.Text = "No Facilities Found / Invalid Facility..!"; mpeAddPatientStatus.Show(); } else if (Pat_Det.DocID == 0) { //lblStatus.Visible = true; //lblStatus.Text = "No Doctors Found / Invalid Doctor..!"; divPatWarning.Visible = true; divPatError.Visible = false; divPatSuccess.Visible = false; lblAddPatientStatus.Text = "No Doctors Found / Invalid Doctor..!"; mpeAddPatientStatus.Show(); } else { Pat_Info.update_patInfo(userID, Pat_Det, Pat_Name); Response.Redirect("AllPatientProfile.aspx?patID=" + Request.QueryString["patID"].ToString()); } } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } objNLog.Info("Event Completed.."); }
public string Update_Patient(PatientName Pat_Name, PatientPersonalDetails Pat_Per_Details, PatientAddress Pat_Add, PatientInsuranceDetails Pat_Ins_Details, PatientAllergies Pat_Allergies, FacilityInfo Fac_Info, PharmacyInfo Phrm_Info,ProviderInfo Prov_Info) { SqlConnection sqlCon = new SqlConnection(ConStr); SqlCommand sqlCmd = new SqlCommand("sp_update_Patient", sqlCon); sqlCmd.CommandType = CommandType.StoredProcedure; SqlParameter P_ID = sqlCmd.Parameters.Add("@Pat_ID", SqlDbType.Int); P_ID.Value = Pat_Name.Pat_ID; SqlParameter P_MName = sqlCmd.Parameters.Add("@Pat_MName", SqlDbType.VarChar, 50); if (Pat_Name.MiddleName != null) P_MName.Value = Pat_Name.MiddleName; else P_MName.Value = Convert.DBNull; SqlParameter P_Gender = sqlCmd.Parameters.Add("@Pat_Gender", SqlDbType.Char, 1); if (Pat_Per_Details.Gender != null) P_Gender.Value = Pat_Per_Details.Gender; else P_Gender.Value = Convert.DBNull; SqlParameter P_DOB = sqlCmd.Parameters.Add("@Pat_DOB", SqlDbType.DateTime); if (Pat_Per_Details.DOB != null) P_DOB.Value = DateTime.Parse(Pat_Per_Details.DOB); else { Nullable<DateTime> NullDate = null; P_DOB.Value = NullDate; } SqlParameter P_SSN = sqlCmd.Parameters.Add("@Pat_SSN", SqlDbType.VarChar, 50); if (Pat_Per_Details.SSN != null) P_SSN.Value = Pat_Per_Details.SSN; else P_SSN.Value = Convert.DBNull; SqlParameter P_Address1 = sqlCmd.Parameters.Add("@Pat_Address1", SqlDbType.VarChar, 50); if (Pat_Add.Address1 != null) P_Address1.Value = Pat_Add.Address1; else P_Address1.Value = Convert.DBNull; SqlParameter P_Address2 = sqlCmd.Parameters.Add("@Pat_Address2", SqlDbType.VarChar, 50); if (Pat_Add.Address2 != null) P_Address2.Value = Pat_Add.Address2; else P_Address2.Value = Convert.DBNull; SqlParameter P_City = sqlCmd.Parameters.Add("@Pat_City", SqlDbType.VarChar, 50); if (Pat_Add.City != null) P_City.Value = Pat_Add.City; else P_City.Value = Convert.DBNull; SqlParameter P_State = sqlCmd.Parameters.Add("@Pat_State", SqlDbType.VarChar, 50); if (Pat_Add.State != null) P_State.Value = Pat_Add.State; else P_State.Value = Convert.DBNull; SqlParameter P_ZIP = sqlCmd.Parameters.Add("@Pat_Zip", SqlDbType.VarChar, 50); if (Pat_Add.Zip != null) P_ZIP.Value = Pat_Add.Zip; else P_ZIP.Value = Convert.DBNull; SqlParameter P_PDoc = sqlCmd.Parameters.Add("@Pat_PDoc", SqlDbType.VarChar, 50); if (Pat_Per_Details.Pat_Pre_Doc != null) P_PDoc.Value = Pat_Per_Details.Pat_Pre_Doc; else P_PDoc.Value = Convert.DBNull; SqlParameter P_MRN = sqlCmd.Parameters.Add("@Pat_MRN", SqlDbType.VarChar, 15); if (Pat_Per_Details.MRN != null) P_MRN.Value = Pat_Per_Details.MRN; else P_MRN.Value = Convert.DBNull; SqlParameter Fac_ID = sqlCmd.Parameters.Add("@Fac_ID", SqlDbType.Int); if (Fac_Info.FacilityNO != null) Fac_ID.Value = Fac_Info.FacilityNO; else Fac_ID.Value = Convert.DBNull; SqlParameter Phrm_ID = sqlCmd.Parameters.Add("@Phrm_ID", SqlDbType.Int); if (Phrm_Info.PhrmID != null) Phrm_ID.Value = Phrm_Info.PhrmID; else Phrm_ID.Value = Convert.DBNull; //SqlParameter PI_InsName = sqlCmd.Parameters.Add("@Ins_Name", SqlDbType.VarChar, 50); //if (Pat_Ins_Details.InsuranceName != null) // PI_InsName.Value = Pat_Ins_Details.InsuranceName; //else // PI_InsName.Value = Convert.DBNull; int InsID = getInsuranceID(Pat_Ins_Details); Pat_Ins_Details.InsuranceID = InsID; SqlParameter Ins_ID = sqlCmd.Parameters.Add("@Ins_ID", SqlDbType.Int); if (Pat_Ins_Details.InsuranceID.ToString() != "0") Ins_ID.Value = Pat_Ins_Details.InsuranceID; else Ins_ID.Value = Convert.DBNull; SqlParameter PI_No = sqlCmd.Parameters.Add("@PI_Number", SqlDbType.Int); if (Pat_Ins_Details.PI_PolicyNo.ToString() != "0") PI_No.Value = Pat_Ins_Details.PI_PolicyNo; else PI_No.Value = Convert.DBNull; SqlParameter PI_PolicyID = sqlCmd.Parameters.Add("@PI_PolicyID", SqlDbType.Int); if (Pat_Ins_Details.PI_PolicyID.ToString() != "0") PI_PolicyID.Value = Pat_Ins_Details.PI_PolicyID; else PI_PolicyID.Value = Convert.DBNull; SqlParameter PI_GroupNo = sqlCmd.Parameters.Add("@PI_GroupNo", SqlDbType.Int); if (Pat_Ins_Details.PI_GroupNo.ToString() != "0") PI_GroupNo.Value = Pat_Ins_Details.PI_GroupNo; else PI_GroupNo.Value = Convert.DBNull; SqlParameter PI_BINNo = sqlCmd.Parameters.Add("@PI_BINNo", SqlDbType.Int); if (Pat_Ins_Details.PI_BINNo.ToString() != "0") PI_BINNo.Value = Pat_Ins_Details.PI_BINNo; else PI_BINNo.Value = Convert.DBNull; SqlParameter PI_InsdName = sqlCmd.Parameters.Add("@PI_InsdName", SqlDbType.VarChar, 50); if (Pat_Ins_Details.InsuredName != null) PI_InsdName.Value = Pat_Ins_Details.InsuredName; else PI_InsdName.Value = Convert.DBNull; SqlParameter PI_InsdDOB = sqlCmd.Parameters.Add("@PI_InsdDOB", SqlDbType.DateTime); if (Pat_Ins_Details.InsuredDOB != null) PI_InsdDOB.Value = DateTime.Parse( Pat_Ins_Details.InsuredDOB); else { Nullable<DateTime> NullDate = null; PI_InsdDOB.Value = NullDate; } SqlParameter PI_InsdSSN = sqlCmd.Parameters.Add("@PI_InsdSSN", SqlDbType.VarChar, 50); if (Pat_Ins_Details.InsuredSSN != null) PI_InsdSSN.Value = Pat_Ins_Details.InsuredSSN; else PI_InsdSSN.Value = Convert.DBNull; SqlParameter PI_InsdRel = sqlCmd.Parameters.Add("@PI_InsdRel", SqlDbType.VarChar, 50); if (Pat_Ins_Details.InsuredRelation != null) PI_InsdRel.Value = Pat_Ins_Details.InsuredRelation; else PI_InsdRel.Value = Convert.DBNull; SqlParameter PA_Desc = sqlCmd.Parameters.Add("@PA_Desc", SqlDbType.VarChar, 200); if (Pat_Allergies.AllergyDescription != null) PA_Desc.Value = Pat_Allergies.AllergyDescription; else PA_Desc.Value = Convert.DBNull; try { sqlCon.Open(); sqlCmd.ExecuteNonQuery(); } catch (Exception ex) { return ex.ToString(); } finally { sqlCon.Close(); } return "Updated Patient Information Successfully"; }