//Updates the medical Inforamation public void update_patMedInfo(PatinetMedHistoryInfo Pat_med) { objNLog.Info("Function Started with Pat_med as argument..."); bool successFlag = false; SqlConnection sqlCon = new SqlConnection(conStr); try { string sqlQuery = "update Patient_Med_History set Qty=" + Pat_med.Quantity + ",SIG='" + Pat_med.SIG + "',Refills=" + Pat_med.Refills + " where CM_ID=" + Pat_med.CM_ID; SqlCommand sqlCmd = new SqlCommand(sqlQuery, sqlCon); sqlCon.Open(); sqlCmd.ExecuteNonQuery(); successFlag = true; } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Updating Patient Med Info.", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Updating Patient Med Info.", ex); } finally { sqlCon.Close(); objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); }
public void set_ShipLog(PatinetMedHistoryInfo Pat_MedInfo) { objNLog.Info("Function started with Pat_MedInfo as parameter."); bool successFlag = false; SqlConnection sqlCon = new SqlConnection(conStr); try { SqlCommand cmd = new SqlCommand("sp_set_ShipLogInfo", sqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter Rx_ItemID = cmd.Parameters.Add("@Rx_ItemID", SqlDbType.Int); Rx_ItemID.Value = Pat_MedInfo.RXItemID; SqlParameter Date_Shipped = cmd.Parameters.Add("@Date_Shipped", SqlDbType.SmallDateTime); Date_Shipped.Value = Pat_MedInfo.ShipDate; SqlParameter Tracking_Number = cmd.Parameters.Add("@Tracking_Number", SqlDbType.VarChar, 255); Tracking_Number.Value = Pat_MedInfo.TrackingNo; SqlParameter Delivery_Mode = cmd.Parameters.Add("@Delivery_Mode", SqlDbType.VarChar, 1); Delivery_Mode.Value = Pat_MedInfo.DeliveryMode; SqlParameter Shipping_Details = cmd.Parameters.Add("@Shipping_Details", SqlDbType.VarChar, 255); Shipping_Details.Value = Pat_MedInfo.ShippingDetails; SqlParameter Ship2Address = cmd.Parameters.Add("@Ship2Address", SqlDbType.VarChar, 255); Ship2Address.Value = Pat_MedInfo.ShippingAdd; //@Delivery_Confirmation SqlParameter Delivery_Confirmation = cmd.Parameters.Add("@Delivery_Confirmation", SqlDbType.VarChar, 255); Delivery_Confirmation.Value = Pat_MedInfo.DeliveryConfirm; SqlParameter Delivery_Status = cmd.Parameters.Add("@Delivery_Status", SqlDbType.VarChar, 255); Delivery_Status.Value = Pat_MedInfo.DeliveryStatus; sqlCon.Open(); cmd.ExecuteNonQuery(); successFlag=true; } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Adding ShipLog.", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Adding ShipLog.", ex); } finally { sqlCon.Close(); objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Status: " + successFlag); objNLog.Info("Function Terminated..."); }
public string set_PatientAppointments(string userID,PatinetMedHistoryInfo Pat_MedInfo) { objNLog.Info("Function started with Pat_MedInfo as Argument..."); bool successFlag = false; string flag = ""; SqlConnection sqlCon = new SqlConnection(conStr); try { SqlCommand cmd = new SqlCommand("sp_set_PatientAppointments", sqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter Pat_ID = cmd.Parameters.Add("@PAT_ID", SqlDbType.Int); Pat_ID.Value = Pat_MedInfo.Pat_ID; SqlParameter Fac_ID = cmd.Parameters.Add("@Fac_ID", SqlDbType.Int); Fac_ID.Value = Pat_MedInfo.Fac_ID; SqlParameter Doc_ID = cmd.Parameters.Add("@Doc_ID", SqlDbType.Int); Doc_ID.Value = Pat_MedInfo.Doc_ID; SqlParameter App_Type = cmd.Parameters.Add("@APPT_Type", SqlDbType.Char, 1); App_Type.Value = Pat_MedInfo.AppointmentType; SqlParameter App_Date = cmd.Parameters.Add("@APPT_Date", SqlDbType.DateTime); App_Date.Value = Convert.ToDateTime(Pat_MedInfo.AppoitmentDate.ToString()); SqlParameter App_Time = cmd.Parameters.Add("@APPT_Time", SqlDbType.DateTime); App_Time.Value = Convert.ToDateTime(Pat_MedInfo.AppointmentTime.ToString()); SqlParameter App_Purp = cmd.Parameters.Add("@App_Purp", SqlDbType.VarChar, 255); App_Purp.Value = Pat_MedInfo.App_Purp; SqlParameter APPT_Status_Code = cmd.Parameters.Add("@APPT_Status_Code", SqlDbType.Char, 1); APPT_Status_Code.Value = 'S'; SqlParameter App_Note = cmd.Parameters.Add("@App_Note", SqlDbType.VarChar, 255); App_Note.Value = Pat_MedInfo.App_Note; sqlCon.Open(); cmd.ExecuteNonQuery(); flag = "Appointment Created Successfully..."; successFlag = true; objUALog.LogUserActivity(conStr, userID, "Created Patient Appointment for PatID = " + Pat_MedInfo.Pat_ID.ToString() + " with Doctor ID = " + Pat_MedInfo.Doc_ID.ToString(), "Patient_Appointments", Pat_MedInfo.Pat_ID); } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Adding Patient Appointment.", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Adding Patient Appointment.", ex); } finally { sqlCon.Close(); objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); return flag; }
public void set_newPatMedication(PatinetMedHistoryInfo Pat_MedInfo) { objNLog.Info("Function Started with Pat_MedInfo"); bool successFlag = false; SqlConnection sqlCon = new SqlConnection(conStr); try { SqlCommand cmd = new SqlCommand("sp_set_PatientMedicalInfo", sqlCon); cmd.CommandType = CommandType.StoredProcedure; SqlParameter par_Medicine = cmd.Parameters.Add("@Medicine", SqlDbType.VarChar, 50); par_Medicine.Value = Pat_MedInfo.Madicine; SqlParameter par_Quantity = cmd.Parameters.Add("@Quantity", SqlDbType.Int); par_Quantity.Value = Pat_MedInfo.Quantity; SqlParameter par_SIG = cmd.Parameters.Add("@SIG", SqlDbType.VarChar, 50); par_SIG.Value = Pat_MedInfo.SIG; SqlParameter par_Refills = cmd.Parameters.Add("@Refills", SqlDbType.Int); par_Refills.Value = Pat_MedInfo.Refills; SqlParameter par_DocID = cmd.Parameters.Add("@DocID", SqlDbType.Int); par_DocID.Value = Pat_MedInfo.Doc_ID; SqlParameter par_DocFullname=cmd.Parameters.Add("@Doc_Name",SqlDbType.VarChar,50); par_DocFullname.Value = Pat_MedInfo.Doc_FullName; SqlParameter par_RxDate = cmd.Parameters.Add("@RxDate", SqlDbType.DateTime); par_RxDate.Value = Pat_MedInfo.Rx_Date; SqlParameter par_Pat_ID = cmd.Parameters.Add("@Pat_ID", SqlDbType.Int); par_Pat_ID.Value = Pat_MedInfo.Pat_ID; sqlCon.Open(); cmd.ExecuteNonQuery(); successFlag = true; } catch (SqlException SqlEx) { objNLog.Error("SQLException : " + SqlEx.Message); throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Inserting Patient Med Info.", SqlEx); } catch (Exception ex) { objNLog.Error("Exception : " + ex.Message); throw new Exception("**Error occured while Inserting Patient Med Info.", ex); } finally { sqlCon.Close(); objNLog.Info("Finally Block: " + successFlag); } objNLog.Info("Function Completed..."); }
protected void btnSaveMed_Click(object sender, EventArgs e) { objNLog.Info("Save Medication Click Event Started..."); string userID = (string)Session["User"]; PatinetMedHistoryInfo objPat_Med_His_Info = new PatinetMedHistoryInfo(); try { if (DateTime.Parse(txtRXDate.Text) > DateTime.Parse(DateTime.Now.ToShortDateString())) { string str = "alert('RxDate Can't Exceed Current Date ... !');"; ScriptManager.RegisterStartupScript(btnSave, typeof(Page), "alert", str, true); AddMedcation.Show(); } else { if (objPat_Info.get_MedicationNames(txtMedicationName.Text).Rows.Count <= 0) { objPat_Info.set_newMedication(userID, txtMedicationName.Text); objPat_Med_His_Info.Madicine = txtMedicationName.Text; } else { objPat_Med_His_Info.Madicine = txtMedicationName.Text; } TextBox popuptxtQty = ((TextBox)pnlAddMedication.FindControl("txtQty")); objPat_Med_His_Info.Quantity = int.Parse(popuptxtQty.Text); TextBox popuptxtMedName = ((TextBox)pnlAddMedication.FindControl("txtMedicationName")); objPat_Med_His_Info.Madicine = popuptxtMedName.Text; //Added for SIG Codes Description - START. string[] sig; if (txtDirection.Text != "" && txtDirection.Text.Contains("||")) { sig = txtDirection.Text.Split(new string[] { "||" }, StringSplitOptions.None); objPat_Med_His_Info.SIG = sig[1].TrimStart().ToString(); } else objPat_Med_His_Info.SIG = txtDirection.Text; //Added for SIG Codes Description - END. objPat_Med_His_Info.Rx_Date = DateTime.Parse(txtRXDate.Text); string DocLName; SqlConnection sqlCon = new SqlConnection(conStr); if ((txtDoc.Text).IndexOf(",") > 0) { objPat_Med_His_Info.Doc_FullName = ((TextBox)pnlAddMedication.FindControl("txtDoc")).Text; string[] arInfo; char[] splitter = { ',' }; arInfo = (txtDoc.Text).Split(splitter); DocLName = arInfo[0]; SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandText = "select Doc_ID from Doctor_Info where Status<>'N' and Doc_LName='" + DocLName + "'"; sqlCmd.Connection = sqlCon; sqlCon.Open(); SqlDataReader dr = sqlCmd.ExecuteReader(); if (dr.Read()) { objPat_Med_His_Info.Doc_ID = int.Parse(dr[0].ToString()); } else { objPat_Med_His_Info.Doc_ID = 0; } sqlCon.Close(); } else { objPat_Med_His_Info.Doc_ID = 0; } objPat_Med_His_Info.Doc_FullName = txtDoc.Text; objPat_Med_His_Info.Pat_ID = int.Parse(hidPatID.Value); objPat_Med_His_Info.Refills = int.Parse(ddlPopupRefills.SelectedValue.ToString()); objPat_Info.set_newPatMedication(objPat_Med_His_Info); FillgridPatMedInfo(); } } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } objNLog.Info("Save Medication Click Event Completed..."); }
protected void btn_P_Save_Continue_Click(object sender, EventArgs e) { objNLog.Info("Save Prescription Continue Click Event Started..."); //if (CheckIfDuplicateRequest()) //{ // FillgridPriscrition(); //} //else //{ PatinetMedHistoryInfo objPat_Med_His_Info = new PatinetMedHistoryInfo(); string userID = (string)Session["User"]; int DocID = objPat_Info.Get_DocID(txtDocName.Text); int DrugID = objPat_Info.Get_MedID(txt_P_Med.Text); if (DocID > 0 && DrugID > 0) { string Pharmacy = "AdiO Pharmacy"; if (rbtnOtherPharmacy.Checked) { if (txtPharmacy.Text.Trim() == "") Pharmacy = "Other Pharmacy"; else Pharmacy = txtPharmacy.Text; } string rxtype = ""; if (rbtnPAP.Checked) rxtype = "P"; if (rbtnSample.Checked) rxtype = "S"; if (rbtnRegular.Checked) rxtype = "R"; SqlConnection sqlCon = new SqlConnection(conStr); SqlCommand sqlCmd = new SqlCommand("SetRXData", sqlCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = 0; try { if (hidRXID.Value == "") { SqlParameter sql_Doc_ID = sqlCmd.Parameters.Add("@Doc_ID", SqlDbType.Int); sql_Doc_ID.Value = DocID; SqlParameter sql_Rx_PharmacyName = sqlCmd.Parameters.Add("@Rx_PharmacyName", SqlDbType.VarChar, 50); sql_Rx_PharmacyName.Value = Pharmacy; } else { SqlParameter sql_Rx_ID = sqlCmd.Parameters.Add("@Rx_ID", SqlDbType.Int); sql_Rx_ID.Value = int.Parse(hidRXID.Value); } SqlParameter sql_Pat_ID = sqlCmd.Parameters.Add("@Pat_ID", SqlDbType.Int); sql_Pat_ID.Value = int.Parse(hidPatID.Value); SqlParameter sql_Rx_Type = sqlCmd.Parameters.Add("@Rx_Type", SqlDbType.Char, 1); sql_Rx_Type.Value = rxtype; SqlParameter sql_Rx_DrugName = sqlCmd.Parameters.Add("@Rx_DrugName", SqlDbType.VarChar, 50); sql_Rx_DrugName.Value = txt_P_Med.Text.Trim(); SqlParameter sql_Rx_Qty = sqlCmd.Parameters.Add("@Rx_Qty", SqlDbType.Int); sql_Rx_Qty.Value = txt_P_Qty.Text; SqlParameter sql_Rx_Refills = sqlCmd.Parameters.Add("@Rx_Refills", SqlDbType.Int); sql_Rx_Refills.Value = ddl_P_Refills.SelectedValue; //Added for SIG Codes Description - START. string[] sig; if (txt_P_sig.Text != "" && txt_P_sig.Text.Contains("||")) { sig = txt_P_sig.Text.Split(new string[] { "||" }, StringSplitOptions.None); objPat_Med_His_Info.SIG = sig[1].TrimStart().ToString(); } else objPat_Med_His_Info.SIG = txt_P_sig.Text; SqlParameter sql_Rx_SIG = sqlCmd.Parameters.Add("@Rx_SIG", SqlDbType.VarChar, 50); sql_Rx_SIG.Value = objPat_Med_His_Info.SIG; //Added for SIG Codes Description - END. SqlParameter sql_Rx_Status = sqlCmd.Parameters.Add("@Rx_Status", SqlDbType.Char, 1); sql_Rx_Status.Value = ddl_P_Status.SelectedValue; SqlParameter sql_Rx_Comments = sqlCmd.Parameters.Add("@Rx_Comments", SqlDbType.VarChar, 1000); sql_Rx_Comments.Value = txtRxComments.Text; SqlParameter sql_Rx_FillDate = sqlCmd.Parameters.Add("@Rx_FillDate", SqlDbType.VarChar, 50); sql_Rx_FillDate.Value = txtFillDate.Text; if (txtFillDate.Text.Trim() == "") sql_Rx_FillDate.Value = DateTime.Now.ToShortDateString(); SqlParameter sql_Rx_MBy = sqlCmd.Parameters.Add("@Rx_ModifiedBy", SqlDbType.VarChar, 50); sql_Rx_MBy.Value = (string)Session["User"]; //Added for Rx Document Attachment byte[] rxDoc = null; if (FileUpRxDoc.PostedFile != null && FileUpRxDoc.PostedFile.FileName != "") { rxDoc = new byte[FileUpRxDoc.PostedFile.ContentLength]; HttpPostedFile Image = FileUpRxDoc.PostedFile; Image.InputStream.Read(rxDoc, 0, (int)FileUpRxDoc.PostedFile.ContentLength); } SqlParameter Rx_Doc = sqlCmd.Parameters.Add("@Rx_Doc", SqlDbType.Image); if (rxDoc != null) Rx_Doc.Value = rxDoc; else Rx_Doc.Value = Convert.DBNull; SqlParameter sql_Rx_SysFlag = sqlCmd.Parameters.Add("@Rx_SysFlag", SqlDbType.VarChar, 50); if (chkRx30Patient.Checked == true) sql_Rx_SysFlag.Value = "P"; else sql_Rx_SysFlag.Value = "R"; //Added for Rx Document Attachment SqlParameter sql_RXID = sqlCmd.Parameters.Add("@RXID", SqlDbType.Int); sql_RXID.Direction = ParameterDirection.Output; sqlCon.Open(); sqlCmd.ExecuteNonQuery(); objUALog.LogUserActivity(conStr, userID, "Added New Prescription(Rx) Info. RxID = " + sql_RXID.Value.ToString(), "Patient_Rx, Rx_Drug_Info", int.Parse((string)hidPatID.Value)); FillgridPriscrition(); hidRXID.Value = sql_RXID.Value.ToString(); txtDocName.Enabled = false; addPrescription.Show(); rbtnAdioPharmacy.Checked = true; rbtnOtherPharmacy.Checked = false; txt_P_Med.Text = ""; txt_P_Qty.Text = ""; txt_P_sig.Text = ""; txtRxComments.Text = ""; ddl_P_Refills.SelectedIndex = 0; ddl_P_Status.SelectedIndex = 0; txtFillDate.Text = DateTime.Now.ToShortDateString(); rbtnRegular.Checked = true; //Session["DupRxRecord"] = txt_P_Med.Text; //Session["DupPatRecord"] = hidPatID.Value; //Session["DupRxFillDt"] = txtFillDate.Text; lblPresStatus.Text = ""; lblPresStatus.Attributes.CssStyle[HtmlTextWriterStyle.Visibility] = "hidden"; //lblPresStatus.Visible = false; } catch (Exception ex) { objNLog.Error("Error : " + ex.Message); } finally { sqlCon.Close(); } } else if (DrugID == 0) { //lblPresStatus.Visible = true; lblPresStatus.Attributes.CssStyle[HtmlTextWriterStyle.Visibility] = "visible"; lblMsg.ForeColor = System.Drawing.Color.Red; lblPresStatus.Text = "Error: Invalid Drug Name..!"; addPrescription.Show(); } else if (DocID == 0) { lblPresStatus.Attributes.CssStyle[HtmlTextWriterStyle.Visibility] = "visible"; //lblPresStatus.Visible = true; lblPresStatus.Text = "Error: Invalid Doctor Name..!"; addPrescription.Show(); } objNLog.Info("Save Prescription Continue Click Event Completed..."); //} }