Beispiel #1
0
 public PatientInsuranceDetails UpdatePatientInsuranceData(int id, PatientInsuranceDetails patientInfo)
 {
     try
     {
         if (id > 0)
         {
             var patientInsuranceDetails = _context.PatientInsuranceDetails.Find(id);
             if (patientInsuranceDetails != null)
             {
                 patientInsuranceDetails.PatientID                  = patientInfo.PatientID;
                 patientInsuranceDetails.InsuranceCompanyID         = patientInfo.InsuranceCompanyID;
                 patientInsuranceDetails.InsuranceCompanyAddress    = patientInfo.InsuranceCompanyAddress;
                 patientInsuranceDetails.InsuranceIDNumber          = patientInfo.InsuranceIDNumber;
                 patientInsuranceDetails.InsuranceGroupName         = patientInfo.InsuranceGroupName;
                 patientInsuranceDetails.InsurancePlanName          = patientInfo.InsurancePlanName;
                 patientInsuranceDetails.InsurancePlanTypeID        = patientInfo.InsurancePlanTypeID;
                 patientInsuranceDetails.InsuranceTypeID            = patientInfo.InsuranceTypeID;
                 patientInsuranceDetails.InsuranceClaimOfficeNumber = patientInfo.InsuranceClaimOfficeNumber;
                 patientInsuranceDetails.VisitsAllowedPerYear       = patientInfo.VisitsAllowedPerYear;
                 patientInsuranceDetails.CardIssueDate              = patientInfo.CardIssueDate;
                 patientInsuranceDetails.Notes = patientInfo.Notes;
                 if (!string.IsNullOrEmpty(patientInfo.Base64Front))
                 {
                     patientInsuranceDetails.InsurancePhotoPathFront      = patientInfo.InsurancePhotoPathFront;
                     patientInsuranceDetails.InsurancePhotoPathThumbFront = patientInfo.InsurancePhotoPathThumbFront;
                 }
                 if (!string.IsNullOrEmpty(patientInfo.Base64Back))
                 {
                     patientInsuranceDetails.InsurancePhotoPathBack      = patientInfo.InsurancePhotoPathBack;
                     patientInsuranceDetails.InsurancePhotoPathThumbBack = patientInfo.InsurancePhotoPathThumbBack;
                 }
                 patientInsuranceDetails.InsurancePersonSameAsPatient = patientInfo.InsurancePersonSameAsPatient;
                 patientInsuranceDetails.IsActive    = patientInfo.IsActive;
                 patientInsuranceDetails.UpdatedDate = DateTime.Now;
                 patientInsuranceDetails.UpdatedBy   = patientInfo.UpdatedBy;
                 patientInsuranceDetails.IsVerified  = patientInfo.IsVerified;
                 _context.SaveChanges();
             }
             return(patientInsuranceDetails);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #2
0
    public void Update_Pat_Insurance(string userID,PatientInsuranceDetails pInsDetails,int patID)
    {
        bool successFlag = false;
        SqlConnection sqlCon = new SqlConnection(conStr);
        objNLog.Info("Function Started with parameter pInsDetails");
        try
        {
            SqlCommand sqlCmd = new SqlCommand("sp_Update_Pat_Ins", sqlCon);
            sqlCmd.CommandType = CommandType.StoredProcedure;

            SqlParameter Pat_Ins_ID = sqlCmd.Parameters.Add("@Pat_Ins_ID", SqlDbType.Int);
            Pat_Ins_ID.Value = pInsDetails.PI_ID;

            SqlParameter Pat_ID = sqlCmd.Parameters.Add("@Pat_ID", SqlDbType.Int);
            Pat_ID.Value = pInsDetails.Pat_ID;
            SqlParameter Ins_ID = sqlCmd.Parameters.Add("@Ins_ID", SqlDbType.Int);
            Ins_ID.Value = pInsDetails.InsuranceID;
            SqlParameter PI_PolicyID = sqlCmd.Parameters.Add("@PI_PolicyID", SqlDbType.VarChar, 25);
            PI_PolicyID.Value = pInsDetails.PI_PolicyID;
            SqlParameter PI_GroupNo = sqlCmd.Parameters.Add("@PI_GroupNo", SqlDbType.VarChar, 25);
            PI_GroupNo.Value = pInsDetails.PI_GroupNo;
            SqlParameter PI_BINNo = sqlCmd.Parameters.Add("@PI_BINNo", SqlDbType.VarChar, 25);
            PI_BINNo.Value = pInsDetails.PI_BINNo;
            SqlParameter PI_InsdName = sqlCmd.Parameters.Add("@PI_InsdName", SqlDbType.VarChar, 50);
            PI_InsdName.Value = pInsDetails.InsuredName;
            SqlParameter PI_InsdDoB = sqlCmd.Parameters.Add("@PI_InsdDoB", SqlDbType.VarChar, 50);
            PI_InsdDoB.Value = pInsDetails.InsuredDOB;
            SqlParameter PI_InsdSSN = sqlCmd.Parameters.Add("@PI_InsdSSN", SqlDbType.VarChar, 50);
            PI_InsdSSN.Value = pInsDetails.InsuredSSN;
            SqlParameter PI_InsdRel = sqlCmd.Parameters.Add("@PI_InsdRel", SqlDbType.VarChar, 50);
            PI_InsdRel.Value = pInsDetails.InsuredRelation;
            SqlParameter PI_ActiveFlagYN = sqlCmd.Parameters.Add("@PI_ActiveFlagYN", SqlDbType.Char, 1);
            PI_ActiveFlagYN.Value = pInsDetails.IsActive;
            SqlParameter IsPrimaryIns = sqlCmd.Parameters.Add("@IsPrimaryIns", SqlDbType.Char, 1);
            IsPrimaryIns.Value = pInsDetails.IsPrimaryIns;
            SqlParameter PI_InsPhone = sqlCmd.Parameters.Add("@PI_InsPhone", SqlDbType.VarChar, 25);
            PI_InsPhone.Value = pInsDetails.InsPhone;

            sqlCon.Open();
            sqlCmd.ExecuteNonQuery();

            objNLog.Info("Insurance Updated Successfully...");
            objNLog.Info("<sp_Update_Pat_Ins>Stored Procedure Executed Successfully...");
            successFlag = true;
            objUALog.LogUserActivity(conStr, userID, "Updated Patient Insurance Info", "Patient_Ins",patID);
        }
        catch (SqlException SqlEx)
        {
            objNLog.Error("SQLException : " + SqlEx.Message);
            throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Updating Patient Insurance.", SqlEx);
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
            throw new Exception("**Error occured while Updating Patient Insurance.", ex);
        }
        finally
        {
            sqlCon.Close();
            objNLog.Info("Finally Block: " + successFlag);
        }
        objNLog.Info("Status: " + successFlag);
        objNLog.Info("Function Terminated...");
    }
Beispiel #3
0
 public PatientInsuranceDetails UpdatePatientInsuranceData(int id, PatientInsuranceDetails patientInfo)
 {
     return(_patientCommonRepository.UpdatePatientInsuranceData(id, patientInfo));
 }
Beispiel #4
0
    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";
    }
Beispiel #5
0
 public string getInsuranceName(PatientInsuranceDetails Pat_Ins_Details)
 {
     SqlConnection con = new SqlConnection(ConStr);
     SqlCommand sqlCmd = new SqlCommand("select Ins_Name from Insurance_Info where Ins_ID = '" + Pat_Ins_Details.InsuranceID + "'", con);
     // SqlDataReader sqlDr;
     // DataTable dtable = new DataTable();
     // DataRow dr;
     con.Open();
     string InsuranceName = sqlCmd.ExecuteScalar().ToString();
     con.Close();
     return InsuranceName;
 }
Beispiel #6
0
 public int getInsuranceID(PatientInsuranceDetails Pat_Ins_Details)
 {
     SqlConnection con = new SqlConnection(ConStr);
     SqlCommand sqlCmd = new SqlCommand("select Ins_ID from Insurance_Info where Ins_Name = '" + Pat_Ins_Details.InsuranceName + "'", con);
        // SqlDataReader sqlDr;
        // DataTable dtable = new DataTable();
     // DataRow dr;
     con.Open();
     int InsuranceID = Convert.ToInt32( sqlCmd.ExecuteScalar());
     con.Close();
     return InsuranceID;
 }