public List <gbmodel.user.User> Select(gbmodel.account.Account p_Account) { //TODO: write logic to execute procedure to load all users under an account //create object of type gbmodel.user.User and add to list. //return the list List <gbmodel.user.User> oUserList = new List <gbmodel.user.User>(); gbmodel.user.User oUser = new gbmodel.user.User(); DataSet ds = null; SqlConnection connection = new SqlConnection(DBUtil.ConnectionString); ArrayList list = new ArrayList(); try { connection.Open(); ds = new DataSet(); SqlCommand sqlCommand = new SqlCommand("sp_select_user_multiple", connection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandTimeout = 0; sqlCommand.Parameters.AddWithValue("@sz_company_id", p_Account.ID); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand); sqlDataAdapter.Fill(ds); foreach (DataRow dr in ds.Tables[0].Rows) { oUser = new gbmodel.user.User(); oUser.Role = new gbmodel.user.Role(); oUser.Provider = new gbmodel.provider.Provider(); oUser.Office = new gbmodel.office.Office(); oUser.ID = dr["sz_user_id"].ToString(); oUser.UserName = dr["sz_user_name"].ToString(); oUser.Password = dr["sz_password"].ToString(); oUser.Role.ID = dr["sz_user_role_id"].ToString(); oUser.Role.Name = dr["sz_user_role"].ToString(); oUser.Provider.Id = dr["sz_provider_id"].ToString(); oUser.Email = dr["sz_email"].ToString(); p_Account.ID = dr["sz_billing_company"].ToString(); oUser.Created = Convert.ToDateTime(dr["dt_created"].ToString()); oUser.LastLogin = Convert.ToDateTime(dr["dt_last_login"].ToString()); oUser.Office.ID = dr["sz_office_id"].ToString(); oUser.ID = dr["sz_created_by"].ToString(); oUser.UserName = dr["sz_created_user_name"].ToString(); oUserList.Add(oUser); } } finally { if (connection != null) { if (connection.State == ConnectionState.Open) { connection.Close(); } connection = null; } } return(oUserList); }
public bool Exists(gbmodel.user.User p_oUser) { //TODO: Return true if user exists (result set returns 1 record) // else return false gbmodel.user.User oUser = new gbmodel.user.User(); SqlConnection connection = new SqlConnection(DBUtil.ConnectionString); DataSet ds = new DataSet(); SqlCommand sqlCommand = new SqlCommand("sp_exists_user", connection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandTimeout = 0; sqlCommand.Parameters.AddWithValue("@sz_user_name", p_oUser.UserName); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand); sqlDataAdapter.Fill(ds); if (ds != null && ds.Tables[0].Rows.Count > 0) { return(false); } else { return(true); } }
/*** * Required input values - gbmodel.account.Account.ID and gbmodel.user.User.ID and UserName ***/ public int Delete(string sz_user_id, string sz_company_id, int IsActive) { //TODO: write logic to execute procedure to delete (update with inactive flag) specific user that is selected //return the rows affected by executing the function int iResult = 0; gbmodel.user.User oUser = new gbmodel.user.User(); SqlConnection connection = new SqlConnection(DBUtil.ConnectionString); try { connection.Open(); SqlCommand sqlCommand = new SqlCommand("sp_disable_users", connection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@sz_company_id", sz_company_id); sqlCommand.Parameters.AddWithValue("@sz_user_id", sz_user_id); sqlCommand.Parameters.AddWithValue("@bt_is_disabled", IsActive); iResult = Convert.ToInt16(sqlCommand.ExecuteNonQuery()); } finally { if (connection != null) { if (connection.State == ConnectionState.Open) { connection.Close(); } connection = null; } } return(iResult); }
public bool UserValidation(gbmodel.user.User oUser) { if (oUser == null) { throw new da.common.exception.IncompleteDataException("Bad Request. User object is null"); } if (oUser.Account == null) { throw new da.common.exception.IncompleteDataException("Bad Request. User.Account object is null"); } if (oUser.Account.ID == null || oUser.Account.ID == "") { throw new da.common.exception.IncompleteDataException("Bad Request. User.Account.ID object is null"); } if (oUser.ID == null || oUser.ID == "") { throw new da.common.exception.IncompleteDataException("Bad Request. User.ID object is null"); } if (oUser.Token == null || oUser.ID == "") { throw new da.common.exception.IncompleteDataException("Bad Request. User.Token object is null"); } if (oUser.Domain == null || oUser.ID == "") { throw new da.common.exception.IncompleteDataException("Bad Request. User.Domain object is null"); } if (oUser.UserName == null || oUser.ID == "") { throw new da.common.exception.IncompleteDataException("Bad Request. User.UserName object is null"); } return(true); }
public List <IntakeProviderDocument> Select(gbmodel.user.User oUser, gbmodel.intakeprovider.IntakeProvider oProvider, gbmodel.casetype.CaseType oCasetype) { List <SqlParameter> oParams = new List <SqlParameter>(); List <IntakeProviderDocument> oList = new List <IntakeProviderDocument>(); oParams.Add(new SqlParameter("@i_provider_id", "" + oProvider.Id)); oParams.Add(new SqlParameter("@sz_case_type_id", oCasetype.ID)); oParams.Add(new SqlParameter("@sz_company_id", oUser.Account.ID)); DataSet ds = null; ds = DBUtil.DataSet(dbconstant.Procedures.PR_INTAKE_DOCUMENT, oParams); if (ds != null) { IntakeProviderDocument oType; DataTable dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { oType = new IntakeProviderDocument(); DataRow dr = dt.Rows[i]; oType.Id = "" + dr["i_document_id"]; oType.Name = "" + dr["sz_name"]; //oType.CreatedDate = Convert.ToDateTime(dr["dt_created"]); //oType.CreatedBy = oUser; //oType.Comapany = oUser.Account; gbmodel.casetype.CaseType obj = new gbmodel.casetype.CaseType(); obj.ID = "" + dr["sz_case_type_id"]; obj.Name = "" + dr["sz_case_type_name"]; oType.CaseType = obj; oList.Add(oType); } } return(oList); }
public ArrayList Search(gbmodel.user.User p_oUser, SearchParameters p_oSearchParameter) { List <SqlParameter> oParams = new List <SqlParameter>(); ArrayList oResult = null; oParams.Add(new SqlParameter("@sz_company_id", p_oUser.Account.ID)); oParams.Add(new SqlParameter("@i_start_index", p_oSearchParameter.StartIndex)); oParams.Add(new SqlParameter("@i_end_index", p_oSearchParameter.EndIndex)); oParams.Add(new SqlParameter("@sz_order_by", p_oSearchParameter.OrderBy)); oParams.Add(new SqlParameter("@sz_search_text", p_oSearchParameter.SearchText)); DataSet ds = null; try { ds = DBUtil.DataSet(Procedures.PR_SEARCH_PATIENT, oParams); } catch (Exception io) { } oResult = new ArrayList(2); List <gbmodel.patient.Patient> oPatientList = new List <gbmodel.patient.Patient>(); gbmodel.patient.Patient oPatient = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { oPatient = new gbmodel.patient.Patient(); oPatient.RowID = Convert.ToInt32(ds.Tables[0].Rows[i]["rowid"].ToString()); oPatient.CaseID = Convert.ToInt32(ds.Tables[0].Rows[i]["sz_case_id"].ToString()); oPatient.CaseNo = Convert.ToInt32(ds.Tables[0].Rows[i]["sz_case_no"].ToString()); oPatient.ClaimNumber = ds.Tables[0].Rows[i]["sz_claim_number"].ToString(); oPatient.Name = ds.Tables[0].Rows[i]["sz_patient_name"].ToString(); gbmodel.carrier.Carrier oCarrier = new gbmodel.carrier.Carrier(); oCarrier.Name = ds.Tables[0].Rows[i]["sz_insurance_company"].ToString(); oPatient.Carrier = oCarrier; oPatient.ID = ds.Tables[0].Rows[i]["sz_patient_id"].ToString(); oPatient.DOA = ds.Tables[0].Rows[i]["dt_accident_date"].ToString(); gbmodel.account.Account oAccount = new gbmodel.account.Account(); oAccount.ID = ds.Tables[0].Rows[i]["sz_company_id"].ToString(); oPatient.Account = oAccount; oPatient.FirstName = ds.Tables[0].Rows[i]["sz_patient_first_name"].ToString(); oPatient.LastName = ds.Tables[0].Rows[i]["sz_patient_last_name"].ToString(); oPatientList.Add(oPatient); } oResult.Add(oPatientList.ToArray()); for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { oResult.Add(ds.Tables[1].Rows[i]["count"].ToString()); } return(oResult); }
public int Update(gbmodel.physician.TreatingPhysician p_oPhysician, gbmodel.user.User p_oUser) { SqlConnection connection = new SqlConnection(DBUtil.ConnectionString); int result = 0; try { connection.Open(); SqlCommand sqlCommand = new SqlCommand("SP_MST_DOCTOR", connection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@SZ_DOCTOR_ID", p_oPhysician.DoctorID); sqlCommand.Parameters.AddWithValue("@SZ_DOCTOR_NAME", p_oPhysician.DoctorName); sqlCommand.Parameters.AddWithValue("@SZ_DOCTOR_LICENSE_NUMBER", p_oPhysician.LicenseNumber); sqlCommand.Parameters.AddWithValue("@SZ_COMPANY_ID", p_oUser.Account.ID); sqlCommand.Parameters.AddWithValue("@SZ_OFFICE_ID", p_oPhysician.Provider.Id); sqlCommand.Parameters.AddWithValue("@SZ_WCB_AUTHORIZATION", p_oPhysician.WCBAuthorization); sqlCommand.Parameters.AddWithValue("@SZ_WCB_RATING_CODE", p_oPhysician.WCBRatingCode); sqlCommand.Parameters.AddWithValue("@SZ_NPI", p_oPhysician.NPI); sqlCommand.Parameters.AddWithValue("@SZ_FEDERAL_TAX_ID", p_oPhysician.FederalTaxID); sqlCommand.Parameters.AddWithValue("@BIT_TAX_ID_TYPE", p_oPhysician.BitTaxIDType); sqlCommand.Parameters.AddWithValue("@SZ_PROCEDURE_GROUP_ID", p_oPhysician.Specialty.ID); sqlCommand.Parameters.AddWithValue("@SZ_TITLE", p_oPhysician.Title); sqlCommand.Parameters.AddWithValue("@I_IS_EMPLOYEE", p_oPhysician.EmployeeType); sqlCommand.Parameters.AddWithValue("@IS_REFERRAL", p_oPhysician.IsReferral); sqlCommand.Parameters.AddWithValue("@BT_IS_UNBILLED", p_oPhysician.IsUnBilled); sqlCommand.Parameters.AddWithValue("@BT_SUPERVISING_DOCTOR", p_oPhysician.IsSupervisingDoctor); sqlCommand.Parameters.AddWithValue("@FLAG", "UPDATE"); result = sqlCommand.ExecuteNonQuery(); } catch (Exception ex) { } finally { if (connection != null) { if (connection.State == ConnectionState.Open) { connection.Close(); } connection = null; } } return(result); }
/*** * Required input values - gbmodel.account.Account.ID and gbmodel.user.User.ID and UserName ***/ public gbmodel.user.User Select(gbmodel.account.Account p_Account, gbmodel.user.User p_oUser) { //TODO: write logic to execute procedure to load specific user that is selected //create object of type gbmodel.user.User and return gbmodel.user.User oUser = new gbmodel.user.User(); SqlConnection connection = new SqlConnection(DBUtil.ConnectionString); DataSet ds = new DataSet(); SqlCommand sqlCommand = new SqlCommand("sp_select_user_single", connection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandTimeout = 0; sqlCommand.Parameters.AddWithValue("@sz_company_id", p_Account.ID); sqlCommand.Parameters.AddWithValue("@sz_user_id", p_oUser.ID); sqlCommand.Parameters.AddWithValue("@sz_user_name", p_oUser.UserName); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand); sqlDataAdapter.Fill(ds); foreach (DataRow dr in ds.Tables[0].Rows) { oUser = new gbmodel.user.User(); oUser.Role = new gbmodel.user.Role(); oUser.Provider = new gbmodel.provider.Provider(); oUser.Office = new gbmodel.office.Office(); oUser.ID = dr["sz_user_id"].ToString(); oUser.UserName = dr["sz_user_name"].ToString(); oUser.Password = dr["sz_password"].ToString(); oUser.Role.ID = dr["sz_user_role_id"].ToString(); oUser.Role.Name = dr["sz_user_role"].ToString(); oUser.Provider.Id = dr["sz_provider_id"].ToString(); oUser.Email = dr["sz_email"].ToString(); p_Account.ID = dr["sz_billing_company"].ToString(); oUser.Created = Convert.ToDateTime(dr["dt_created"].ToString()); oUser.LastLogin = Convert.ToDateTime(dr["dt_last_login"].ToString()); oUser.Office.ID = dr["sz_office_id"].ToString(); oUser.ID = dr["sz_created_by"].ToString(); oUser.UserName = dr["sz_created_user_name"].ToString(); } return(oUser); }
public List <gbmodel.carrier.Carrier> Select(gbmodel.user.User oUser, gbmodel.carrier.Carrier oCarrier) { SqlConnection sqlConnection = null; List <gbmodel.carrier.Carrier> oList = new List <gbmodel.carrier.Carrier>(); try { sqlConnection = new SqlConnection(DBUtil.ConnectionString); sqlConnection.Open(); SqlCommand sqlCommand = null; sqlCommand = new SqlCommand(Procedures.PR_CARRIER_SELECT, sqlConnection);//TODO Add procedure name sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(new SqlParameter("@id", oUser.Account.ID)); sqlCommand.Parameters.Add(new SqlParameter("@FLAG", "INSURANCE_LIST")); SqlDataAdapter da = new SqlDataAdapter(sqlCommand); DataSet ds = new DataSet(); da.Fill(ds); if (ds != null) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; gbmodel.carrier.Carrier oElement = new gbmodel.carrier.Carrier(); oElement.Name = dr["DESCRIPTION"].ToString(); //to do oElement.Id = dr["CODE"].ToString(); //TODO oList.Add(oElement); } } } catch (Exception ex) { } finally { if (sqlConnection.State == ConnectionState.Open) { sqlConnection.Close(); } } return(oList); }
public List <gbmodel.casetype.CaseType> Select(gbmodel.user.User oUser) { SqlConnection sqlConnection = null; List <gbmodel.casetype.CaseType> oList = new List <gbmodel.casetype.CaseType>(); try { sqlConnection = new SqlConnection(DBUtil.ConnectionString); sqlConnection.Open(); SqlCommand sqlCommand = null; sqlCommand = new SqlCommand(Procedures.PR_SELECT_CASETYPE, sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(new SqlParameter("@sz_company_id", oUser.Account.ID)); SqlDataAdapter da = new SqlDataAdapter(sqlCommand); DataSet ds = new DataSet(); da.Fill(ds); if (ds != null) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; gbmodel.casetype.CaseType oElement = new gbmodel.casetype.CaseType(); oElement.Name = dr["Name"].ToString(); //to do oElement.ID = dr["ID"].ToString(); //TODO oList.Add(oElement); } } } catch (Exception ex) { } finally { if (sqlConnection.State == ConnectionState.Open) { sqlConnection.Close(); } } return(oList); }
public int Update(gbmodel.account.Account p_Account, gbmodel.user.User p_oUser, gbmodel.user.User p_oLoginUser, // this is the user who is adding a new user List <gbmodel.physician.Physician> p_lstDoctor, List <gbmodel.provider.Provider> p_lstProvider, List <gbmodel.provider.Provider> p_lstReferringProvider, gbmodel.office.Office o_lstOffice) { int iResult = 0; gbmodel.user.User oUser = new gbmodel.user.User(); this.sSQLCon = dataaccess.ConnectionManager.GetConnectionString(null); SqlConnection connection = new SqlConnection(sSQLCon); connection.Open(); SqlTransaction oTransaction = connection.BeginTransaction(); try { bool result = false; result = Convert.ToBoolean(Exists(p_oUser)); //if (result == false) //{ // throw new Exception("The username is already taken. Please try with a different username"); //} if (result == false) { SqlCommand sqlCommand = new SqlCommand("SP_MST_USERS_UPDATE", connection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Transaction = oTransaction; sqlCommand.Parameters.AddWithValue("@sz_user_name", p_oUser.UserName); sqlCommand.Parameters.AddWithValue("@sz_password", GetEncryptedString(p_oUser.Password)); sqlCommand.Parameters.AddWithValue("@sz_user_role", p_oUser.Role.ID); sqlCommand.Parameters.AddWithValue("@sz_email", p_oUser.Email); sqlCommand.Parameters.AddWithValue("@SZ_BILLING_COMPANY", p_Account.ID); sqlCommand.Parameters.AddWithValue("@sz_user_id", p_oUser.ID); if (p_lstDoctor != null && p_lstDoctor.Count > 0) { sqlCommand.Parameters.AddWithValue("@bt_validate_and_show", p_oUser.IsShowPreviousVisitByDefault); } // If the user has selected role referring office - the add the below parameter if (o_lstOffice != null && o_lstOffice.ID != null && o_lstOffice.ID != "") { sqlCommand.Parameters.AddWithValue("@sz_office_id", o_lstOffice.ID); } //SqlParameter oParamUserID = new SqlParameter("@sz_user_id", SqlDbType.VarChar, 50); //oParamUserID.Direction = ParameterDirection.Output; //sqlCommand.Parameters.Add(oParamUserID); //iResult = sqlCommand.ExecuteNonQuery(); //string sUserID = oParamUserID.Value.ToString(); //if (sUserID == null || sUserID == "") //{ // throw new Exception("Invalid user sequence number generated. User could not be created"); //} iResult = sqlCommand.ExecuteNonQuery(); // If the user has selected role as doctor - the below block will be executed if (p_lstDoctor != null && p_lstDoctor.Count > 0) { // remove the existing doctor-user mapping if any SqlCommand sqlCmdDeMap = new SqlCommand("sp_doctor_userid", connection); sqlCmdDeMap.Transaction = oTransaction; sqlCmdDeMap.CommandType = CommandType.StoredProcedure; sqlCmdDeMap.Parameters.AddWithValue("@sz_company_id", p_Account.ID); sqlCmdDeMap.Parameters.AddWithValue("@sz_user_id", p_oUser.ID); sqlCmdDeMap.Parameters.AddWithValue("@FLAG", "DELETE"); sqlCmdDeMap.ExecuteNonQuery(); foreach (gbmodel.physician.Physician p in p_lstDoctor) { SqlCommand sqlCmd = new SqlCommand("sp_doctor_userid", connection); sqlCmd.Transaction = oTransaction; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@sz_company_id", p_Account.ID); sqlCmd.Parameters.AddWithValue("@sz_user_ID", p_oUser.ID); sqlCmd.Parameters.AddWithValue("@sz_doctor_ID", p.ID); sqlCmd.Parameters.AddWithValue("@FLAG", "ADD"); sqlCmd.ExecuteNonQuery(); } } // If the user has selected role as provider - the below block will be executed if (p_lstProvider != null && p_lstProvider.Count > 0) { SqlCommand sqlCmdDeMap = new SqlCommand("sp_txn_user_provider", connection); sqlCmdDeMap.Transaction = oTransaction; sqlCmdDeMap.CommandType = CommandType.StoredProcedure; sqlCmdDeMap.Parameters.AddWithValue("@sz_company_id", p_Account.ID); sqlCmdDeMap.Parameters.AddWithValue("@sz_user_id", p_oUser.ID); sqlCmdDeMap.Parameters.AddWithValue("@FLAG", "DELETE"); sqlCmdDeMap.ExecuteNonQuery(); foreach (gbmodel.provider.Provider p in p_lstProvider) { SqlCommand cmdProvider = new SqlCommand("sp_txn_user_provider", connection); cmdProvider.Transaction = oTransaction; cmdProvider.CommandType = CommandType.StoredProcedure; cmdProvider.Parameters.AddWithValue("@sz_company_id", p_Account.ID); cmdProvider.Parameters.AddWithValue("@sz_user_id", p_oUser.ID); cmdProvider.Parameters.AddWithValue("@sz_user_provider_name_id", p.Id); cmdProvider.Parameters.AddWithValue("@sz_user_provider_name", p.Name); cmdProvider.Parameters.AddWithValue("@FLAG", "ADD"); cmdProvider.ExecuteNonQuery(); } } // If the user has selected role as referring provider - the below block will be executed if (p_lstReferringProvider != null && p_lstReferringProvider.Count > 0) { SqlCommand sqlCmdDeMap = new SqlCommand("sp_save_user_provider_connection", connection); sqlCmdDeMap.Transaction = oTransaction; sqlCmdDeMap.CommandType = CommandType.StoredProcedure; sqlCmdDeMap.Parameters.AddWithValue("@sz_company_id", p_Account.ID); sqlCmdDeMap.Parameters.AddWithValue("@sz_latest_user_id", p_oUser.ID); sqlCmdDeMap.Parameters.AddWithValue("@sz_reffering_provider_id", ""); sqlCmdDeMap.Parameters.AddWithValue("@sz_user_id", ""); sqlCmdDeMap.Parameters.AddWithValue("@FLAG", "DELETE"); sqlCmdDeMap.ExecuteNonQuery(); foreach (gbmodel.provider.Provider p in p_lstReferringProvider) { SqlCommand sqlCmdReferringProvider = new SqlCommand("sp_save_user_provider_connection", connection); sqlCmdReferringProvider.CommandType = CommandType.StoredProcedure; sqlCmdReferringProvider.Transaction = oTransaction; sqlCmdReferringProvider.Parameters.AddWithValue("@sz_latest_user_id", p_oUser.ID); sqlCmdReferringProvider.Parameters.AddWithValue("@sz_reffering_provider_id", p.Id); sqlCmdReferringProvider.Parameters.AddWithValue("@sz_company_id", p_Account.ID); sqlCmdReferringProvider.Parameters.AddWithValue("@sz_user_id", p_oLoginUser.ID); sqlCmdReferringProvider.Parameters.AddWithValue("@flag", "UPDATE"); sqlCmdReferringProvider.ExecuteNonQuery(); } } oTransaction.Commit(); } else { } } catch (Exception ex) { oTransaction.Rollback(); //log and throw throw ex; } finally { if (connection != null) { if (connection.State == ConnectionState.Open) { connection.Close(); } connection = null; } } return(iResult); }
public gbmodel.user.User Authenticate(gbmodel.user.User p_oUser) { List <SqlParameter> oParams = new List <SqlParameter>(); oParams.Add(new SqlParameter("@username", p_oUser.UserName)); oParams.Add(new SqlParameter("@password", GetEncryptedString(p_oUser.Password))); DataSet ds = null; string sUserName = null; string sUserID = null; gbmodel.user.User oUser = null; ds = DBUtil.DataSet(Procedures.PR_AUTHENTICATION, oParams); if (ds.Tables[0].Rows.Count == 0) { throw new AuthenticationException("Invalid username or password"); } sUserName = ds.Tables[0].Rows[0]["username"].ToString(); sUserID = ds.Tables[0].Rows[0]["ID"].ToString(); if (sUserID != null && sUserName != null && sUserID.Trim().Length != 0 && sUserName.Trim().Length != 0) { oParams = new List <SqlParameter>(); oParams.Add(new SqlParameter("@sz_user_name", p_oUser.UserName)); oParams.Add(new SqlParameter("@flag", "CHECKLOGIN")); // get the user object ds = DBUtil.DataSet(Procedures.PR_DOCTOR_LOGIN_PARAMETERS, oParams); oUser = new gbmodel.user.User(); oUser.ID = sUserID; oUser.UserName = sUserName; oUser.Domain = ds.Tables[0].Rows[0]["DomainName"].ToString(); oUser.Email = ds.Tables[0].Rows[0]["user_email_id"].ToString(); gbmodel.account.Account oAccount = new gbmodel.account.Account(); try { oAccount.ID = ds.Tables[0].Rows[0]["sz_company_id"].ToString(); oAccount.Name = ds.Tables[0].Rows[0]["sz_company_name"].ToString(); } catch (IndexOutOfRangeException _x) { throw new IncompleteDataException("Account data not found for your user account"); } if (oAccount.ID == null || oAccount.Name == null || oAccount.ID == "" || oAccount.Name == "") { throw new IncompleteDataException("Account data not set for your user account"); } gbmodel.user.Role oRole = new gbmodel.user.Role(); oRole.ID = ds.Tables[0].Rows[0]["sz_user_role"].ToString(); oRole.Name = ds.Tables[0].Rows[0]["sz_user_role_name"].ToString(); if (oRole.ID == null || oRole.Name == null || oRole.ID == "" || oRole.Name == "") { throw new IncompleteDataException("User role data not found"); } oUser.Account = oAccount; oUser.Role = oRole; oUser.Token = GenerateUserToken(oUser.UserName, oUser.Domain); } else { throw new AuthenticationException("Invalid username or password"); } return(oUser); }
public string PrintVisitNote(gbmodel.patient.Patient p_oPatient, gbmodel.user.User p_oUser) { specialtyNote.SrvPatient oSrvPatient = new specialtyNote.SrvPatient(); List <gbmodel.patient.SpecialtyNote> oList = new List <gbmodel.patient.SpecialtyNote>(); oList = oSrvPatient.SelectSpecialtyNote(p_oPatient); string OpenPdfFilepath = ""; DataSet ds = new DataSet(); ds = GetVisitInfo(p_oPatient.CaseID, p_oPatient.Account.ID); string szfirstname = ""; if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["PatientName"].ToString() != "") { szfirstname = ds.Tables[0].Rows[0]["PatientName"].ToString(); szfirstname = szfirstname.Replace(" ", string.Empty); szfirstname = szfirstname.Replace(".", string.Empty); szfirstname = szfirstname.Replace(",", string.Empty); } } if (ds != null && ds.Tables[1] != null) { string path = getApplicationSetting("PatientInfoSaveFilePath"); string OpenFilepath = getApplicationSetting("PatientInfoOpenFilePath"); path = path + "PatientDeskNotes/"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string newPdfFilename = szfirstname.Trim() + "_Visit_Information_" + DateTime.Now.ToString("MM_dd_yyyyhhmm") + ".pdf"; string pdfPath = path + newPdfFilename; MemoryStream m = new MemoryStream(); iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.A4, 36, 36, 20, 20); float[] wBase = { 4f }; PdfPTable tblBase = new PdfPTable(wBase); tblBase.DefaultCell.Border = Rectangle.NO_BORDER; tblBase.WidthPercentage = 100; PdfWriter writer = PdfWriter.GetInstance(document, m); document.Open(); #region "for printed by" float[] width = { 4f, 4f }; PdfPTable tblprintby = new PdfPTable(width); tblprintby.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblprintby.DefaultCell.Border = Rectangle.NO_BORDER; tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT; tblprintby.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_TOP; tblprintby.AddCell(new Phrase("Printed By : " + p_oUser.UserName, iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT; tblprintby.AddCell(new Phrase("Printed on : " + DateTime.Now.ToString("MM/dd/yyyy"), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK))); tblBase.AddCell(tblprintby); #endregion tblBase.AddCell(" "); #region "for patient information" float[] wdh = { 4f }; PdfPTable tblheading = new PdfPTable(wdh); tblheading.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; tblheading.DefaultCell.Border = Rectangle.NO_BORDER; tblheading.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER; tblheading.DefaultCell.VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE; tblBase.AddCell(tblheading); #endregion #region for Personal Information float[] w11 = { 3f, 3f, 3f, 3f }; PdfPTable table = new PdfPTable(w11); table.WidthPercentage = 100; table.DefaultCell.BorderColor = Color.BLACK; PdfPCell cell1 = new PdfPCell(new Phrase("Personal Information", iTextSharp.text.FontFactory.GetFont("Arial", 11, iTextSharp.text.Color.BLACK))); cell1.Colspan = 4; cell1.BackgroundColor = Color.LIGHT_GRAY; cell1.BorderColor = Color.BLACK; table.AddCell(cell1); table.AddCell(new Phrase("Patient Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["PatientName"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["PatientName"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Case #", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["CaseNo"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["CaseNo"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } table.AddCell(new Phrase("Insurance Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); if (ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"].ToString() != "") { table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } PdfPCell cell2 = new PdfPCell(new Phrase("")); cell2.Colspan = 2; cell2.BorderColor = Color.BLACK; table.AddCell(cell2); tblBase.AddCell(table); #endregion document.Add(tblBase); DataTable dt = ds.Tables[1]; string[] columns = { "SpecialtyID" }; DataTable dataTable = GetDistinctRecords(dt, columns); DataSet dsFiltered = new DataSet(); dsFiltered.Tables.Add(dataTable); #region for Visit Information float[] wd1 = { 3f, 1.5f, 1.5f, 1.5f, 1.5f, 6f, 1.5f, 3f }; PdfPTable tblVisit = new PdfPTable(wd1); tblVisit.WidthPercentage = 100; tblVisit.DefaultCell.BorderColor = Color.BLACK; tblVisit = GetTableHeader(wd1); float[] wdBlank = { 4f }; PdfPTable tblBlank = new PdfPTable(wdBlank); tblBlank.WidthPercentage = 100; tblBlank.DefaultCell.Border = Rectangle.NO_BORDER; tblBlank.AddCell(""); tblBlank.DefaultCell.Border = Rectangle.NO_BORDER; float[] wdNotes = { .5f, 3.5f }; PdfPTable tblNotes = new PdfPTable(wdNotes); tblNotes.WidthPercentage = 100; string text = ""; for (int i = 0; i < dsFiltered.Tables[0].Rows.Count; i++) { DataRow[] result = ds.Tables[1].Select("SpecialtyID = '" + dsFiltered.Tables[0].Rows[i]["SpecialtyID"].ToString() + "'"); for (int j = 0; j < result.Length; j++) { float fPosition = writer.GetVerticalPosition(true); if (result[j]["DctorName"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["DctorName"].ToString()), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["DT_EVENT_DATE"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["DT_EVENT_DATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["Specialty"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["Specialty"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["STATUS"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["STATUS"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["VisitType"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["VisitType"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["ProcedureCode"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["ProcedureCode"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["BillStatus"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["BillStatus"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } if (result[j]["Provider"].ToString() != "") { tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["Provider"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } else { tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); } } for (int k = 0; k < oList.Count; k++) { if (dsFiltered.Tables[0].Rows[i]["SpecialtyID"].ToString() == oList[k].Speciality.ID.ToString()) { text = oList[k].Text.ToString(); tblNotes.FlushContent(); tblNotes.AddCell(new Phrase("NOTE:", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK))); tblNotes.AddCell(new Phrase(text, iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK))); document.Add(tblBlank); if (text != "") { document.Add(tblNotes); } break; } } document.Add(tblVisit); document.Add(tblBlank); document.Add(tblBlank); tblVisit.DeleteBodyRows(); tblVisit = GetTableHeader(wd1); } #endregion document.Close(); System.IO.File.WriteAllBytes(pdfPath, m.GetBuffer()); OpenPdfFilepath = OpenFilepath + "PatientDeskNotes/" + newPdfFilename; } return(OpenPdfFilepath); }
public string CheckDoctorVisitExists(gbmodel.physician.TreatingPhysician p_oPhysician, gbmodel.user.User p_oUser) { SqlConnection connection = new SqlConnection(DBUtil.ConnectionString); string result = ""; try { connection.Open(); SqlCommand sqlCommand = new SqlCommand("sp_exists_doctor_visit", connection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@sz_doctor_id", p_oPhysician.DoctorID); sqlCommand.Parameters.AddWithValue("@sz_company_id", p_oUser.Account.ID); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); while (sqlDataReader.Read()) { result = sqlDataReader["RECORD EXISTS"].ToString(); } } catch (Exception ex) { } finally { if (connection != null) { if (connection.State == ConnectionState.Open) { connection.Close(); } connection = null; } } return(result); }
public void insertIntake(gbmodel.user.User oUser, Intake oIntake) { }