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 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 List <gbmodel.procedure.Procedure> Select(gbmodel.account.Account oAccount, List <model.specialty.Specialty> p_oSpecialty) { SqlConnection sqlConnection = null; DataTable oDTSpecialty = null; if (p_oSpecialty != null && p_oSpecialty.Count > 0) { oDTSpecialty = gbmodel.specialty.type.TypeSpecialty.FillDBType(p_oSpecialty); } List <gbmodel.procedure.Procedure> oList = new List <gbmodel.procedure.Procedure>(); try { sqlConnection = new SqlConnection(DBUtil.ConnectionString); sqlConnection.Open(); SqlCommand sqlCommand = null; sqlCommand = new SqlCommand("sp_select_procedure_codes_for_specialty", sqlConnection);//TODO Add procedure name sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(new SqlParameter("@sz_company_id", oAccount.ID)); if (oDTSpecialty != null && oDTSpecialty.Rows.Count > 0) { SqlParameter tvpParamSpecialty = sqlCommand.Parameters.AddWithValue( "@tvp_specialty", oDTSpecialty); tvpParamSpecialty.SqlDbType = SqlDbType.Structured; tvpParamSpecialty.TypeName = gbmodel.specialty.type.TypeSpecialty.GetTypeName(); } 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.procedure.Procedure oElement = new gbmodel.procedure.Procedure(); oElement.Code = dr["SZ_PROCEDURE_CODE"].ToString(); oElement.Name = dr["SZ_CODE_DESCRIPTION"].ToString(); oElement.ID = dr["SZ_TYPE_CODE_ID"].ToString(); oElement.Specialty = new model.specialty.Specialty(); oElement.Specialty.ID = dr["sz_specialty_id"].ToString(); oElement.Specialty.Name = dr["sz_specialty_name"].ToString(); oList.Add(oElement); } } } catch (Exception ex) { throw ex; } finally { if (sqlConnection.State == ConnectionState.Open) { sqlConnection.Close(); } } return(oList); }
public List <gbmodel.physician.Physician> SelectReferringDoctor(gbmodel.account.Account p_oAccount, List <gbmodel.office.Office> p_lstOffice) { SqlConnection sqlConnection = null; DataTable oDTOffice = null; if (p_lstOffice != null && p_lstOffice.Count > 0) { oDTOffice = gbmodel.office.type.TypeOffice.FillDBType(p_lstOffice); } List <gbmodel.physician.Physician> oList = new List <gbmodel.physician.Physician>(); try { sqlConnection = new SqlConnection(DBUtil.ConnectionString); sqlConnection.Open(); SqlCommand sqlCommand = null; sqlCommand = new SqlCommand("sp_select_referring_doctor_for_office", sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add(new SqlParameter("@sz_company_id", p_oAccount.ID)); if (oDTOffice != null && oDTOffice.Rows.Count > 0) { SqlParameter tvpParamOffice = sqlCommand.Parameters.AddWithValue( "@tvp_office", oDTOffice); tvpParamOffice.SqlDbType = SqlDbType.Structured; tvpParamOffice.TypeName = gbmodel.office.type.TypeOffice.GetTypeName(); } 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.physician.Physician oElement = new gbmodel.physician.Physician(); oElement.Name = dr["Description"].ToString(); oElement.ID = dr["CODE"].ToString(); oList.Add(oElement); } } } catch (Exception ex) { throw ex; } finally { if (sqlConnection.State == ConnectionState.Open) { sqlConnection.Close(); } } return(oList); }
/*** * 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 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 List <gbmodel.physician.ReadingPhysician> Select(gbmodel.account.Account p_Account) { DataSet ds; SqlCommand command; SqlConnection connection = new SqlConnection(DBUtil.ConnectionString); List <gbmodel.physician.ReadingPhysician> sList = new List <gbmodel.physician.ReadingPhysician>(); gbmodel.physician.ReadingPhysician o_ReadingPhysician = new gbmodel.physician.ReadingPhysician(); try { connection.Open(); command = new SqlCommand("SP_MST_READINGDOCTOR", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@SZ_COMPANY_ID", p_Account.ID); command.Parameters.AddWithValue("@FLAG", "LIST"); ds = new DataSet(); new SqlDataAdapter(command).Fill(ds); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { o_ReadingPhysician = new gbmodel.physician.ReadingPhysician(); o_ReadingPhysician.Specialty = new gbmodel.specialty.Specialty(); o_ReadingPhysician.Office = new gbmodel.office.Office(); o_ReadingPhysician.Provider = new gbmodel.provider.Provider(); o_ReadingPhysician.Account = new gbmodel.account.Account(); if (dr["SZ_ASSIGN_NUMBER"] != DBNull.Value) { o_ReadingPhysician.AssignmentNumber = dr["SZ_ASSIGN_NUMBER"].ToString(); } if (dr["SZ_DOCTOR_LICENSE_NUMBER"] != DBNull.Value) { o_ReadingPhysician.LicenseNumber = dr["SZ_DOCTOR_LICENSE_NUMBER"].ToString(); } if (dr["BT_IS_OWNER"] != DBNull.Value) { o_ReadingPhysician.WorkType = Convert.ToInt32(dr["BT_IS_OWNER"]); } if (dr["SZ_TITLE"] != DBNull.Value) { o_ReadingPhysician.Title = dr["SZ_TITLE"].ToString(); } if (dr["SZ_DOCTOR_NAME"] != DBNull.Value) { o_ReadingPhysician.Name = dr["SZ_DOCTOR_NAME"].ToString(); } if (dr["SZ_DOCTOR_TYPE"] != DBNull.Value) { o_ReadingPhysician.DoctorType = dr["SZ_DOCTOR_TYPE"].ToString(); } if (dr["SZ_DOCTOR_TYPE_ID"] != DBNull.Value) { o_ReadingPhysician.DoctorTypeID = dr["SZ_DOCTOR_TYPE_ID"].ToString(); } if (dr["SZ_PROCEDURE_GROUP_ID"] != DBNull.Value) { o_ReadingPhysician.Specialty.ID = dr["SZ_PROCEDURE_GROUP_ID"].ToString(); } if (dr["SZ_PROCEDURE_GROUP"] != DBNull.Value) { o_ReadingPhysician.Specialty.Name = dr["SZ_PROCEDURE_GROUP"].ToString(); } if (dr["SZ_OFFICE_ID"] != DBNull.Value) { o_ReadingPhysician.Office.ID = dr["SZ_OFFICE_ID"].ToString(); } if (dr["SZ_OFFICE"] != DBNull.Value) { o_ReadingPhysician.Office.Name = dr["SZ_OFFICE"].ToString(); } if (dr["SZ_DOCTOR_ID"] != DBNull.Value) { o_ReadingPhysician.ID = dr["SZ_DOCTOR_ID"].ToString(); } if (dr["SZ_COMPANY_ID"] != DBNull.Value) { o_ReadingPhysician.Account.ID = dr["SZ_COMPANY_ID"].ToString(); } if (dr["SZ_PROVIDER_ID"] != DBNull.Value) { o_ReadingPhysician.Provider.Id = dr["SZ_PROVIDER_ID"].ToString(); } if (dr["SZ_WCB_AUTHORIZATION"] != DBNull.Value) { o_ReadingPhysician.WCBAuthorization = dr["SZ_WCB_AUTHORIZATION"].ToString(); } if (dr["SZ_WCB_RATING_CODE"] != DBNull.Value) { o_ReadingPhysician.WCBRatingCode = dr["SZ_WCB_RATING_CODE"].ToString(); } if (dr["SZ_FEDERAL_TAX_ID"] != DBNull.Value) { o_ReadingPhysician.FederalTaxID = dr["SZ_FEDERAL_TAX_ID"].ToString(); } if (dr["BIT_TAX_ID_TYPE"] != DBNull.Value) { o_ReadingPhysician.BitTaxIDType = Convert.ToBoolean(dr["BIT_TAX_ID_TYPE"]); } if (dr["bt_is_disabled"] != DBNull.Value) { o_ReadingPhysician.IsDisabled = Convert.ToBoolean(dr["bt_is_disabled"]); } sList.Add(o_ReadingPhysician); } } } catch (Exception ex) { throw; } finally { if (connection != null) { if (connection.State == ConnectionState.Open) { connection.Close(); } connection = null; } } return(sList); }
public gbmodel.physician.ReadingPhysician Select(gbmodel.account.Account p_Account, gbmodel.physician.ReadingPhysician p_ReadingPhysician) { gbmodel.physician.ReadingPhysician oReadingPhysician = new gbmodel.physician.ReadingPhysician(); try { SqlConnection connection = new SqlConnection(DBUtil.ConnectionString); DataSet ds = new DataSet(); SqlCommand sqlCommand = new SqlCommand("sp_select_reading_doctor_single", connection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandTimeout = 0; sqlCommand.Parameters.AddWithValue("@sz_doctor_id", p_ReadingPhysician.ID); 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) { oReadingPhysician = new gbmodel.physician.ReadingPhysician(); oReadingPhysician.Specialty = new gbmodel.specialty.Specialty(); oReadingPhysician.Office = new gbmodel.office.Office(); if (dr["SZ_TITLE"] != DBNull.Value) { oReadingPhysician.Title = dr["SZ_TITLE"].ToString(); } if (dr["SZ_DOCTOR_NAME"] != DBNull.Value) { oReadingPhysician.Name = dr["SZ_DOCTOR_NAME"].ToString(); } if (dr["SZ_DOCTOR_LICENSE_NUMBER"] != DBNull.Value) { oReadingPhysician.LicenseNumber = dr["SZ_DOCTOR_LICENSE_NUMBER"].ToString(); } if (dr["SZ_ASSIGN_NUMBER"] != DBNull.Value) { oReadingPhysician.AssignmentNumber = dr["SZ_ASSIGN_NUMBER"].ToString(); } if (dr["BT_IS_OWNER"] != DBNull.Value) { oReadingPhysician.WorkType = Convert.ToInt32(dr["BT_IS_OWNER"]); } if (dr["SZ_PROCEDURE_GROUP_ID"] != DBNull.Value) { oReadingPhysician.Specialty.ID = dr["SZ_PROCEDURE_GROUP_ID"].ToString(); } if (dr["SZ_OFFICE_ID"] != DBNull.Value) { oReadingPhysician.Office.ID = dr["SZ_OFFICE_ID"].ToString(); } } } catch (Exception ex) { throw; } return(oReadingPhysician); }