public string CheckNameOfPhysicianExists(PhysicianDetails physicianDetailsObject)
        {
            string result = null;

            databaseObject.CommandToExecute.CommandText = @"uspCheckAvailabilityOfPhysicianName";

            databaseObject.CommandToExecute.CommandType = CommandType.StoredProcedure;

            SqlParameter param1 = new SqlParameter();
            param1.ParameterName = "@physicianFirstName";
            param1.Value = physicianDetailsObject.PhysicianFirstName;
            SqlParameter param2 = new SqlParameter();
            param2.ParameterName = "@physicianLastName";
            param2.Value = physicianDetailsObject.PhysicianLastName;

            try
            {
                databaseObject.CommandToExecute.Connection = databaseObject.DatabaseConnection;

                databaseObject.DatabaseConnection.Open();

                databaseObject.CommandToExecute.Parameters.Add(param1);
                databaseObject.CommandToExecute.Parameters.Add(param2);

                databaseObject.DBDataReader = databaseObject.CommandToExecute.ExecuteReader();
                if (databaseObject.DBDataReader.HasRows == true)
                {
                    while (databaseObject.DBDataReader.Read())
                    {
                        result = databaseObject.DBDataReader[0].ToString();
                    }

                }

            }
            catch (SqlException ex)
            {

            }
            finally
            {
                databaseObject.DatabaseConnection.Close();
            }

            return result;
        }
        public int UpdatePhysicianInfo(PhysicianDetails phyDeatailsObject)
        {
            databaseObject.CommandToExecute.CommandText = @"uspUpdatePhysicianInfo";

            databaseObject.CommandToExecute.CommandType = CommandType.StoredProcedure;

            SqlParameter param1 = new SqlParameter();
            param1.ParameterName = "@PhysicianId";
            param1.Value = phyDeatailsObject.PhysicianId;
            SqlParameter param2 = new SqlParameter();
            param2.ParameterName = "@DeptId";
            param2.Value = phyDeatailsObject.DepartmentId;
            SqlParameter param3 = new SqlParameter();
            param3.ParameterName = "@StateId";
            param3.Value = phyDeatailsObject.PhysicianStateId;
            SqlParameter param4 = new SqlParameter();
            param4.ParameterName = "@PlanId";
            param4.Value = phyDeatailsObject.InsurancePlan;
            SqlParameter param5 = new SqlParameter();
            param5.ParameterName = "@EducationalQualification";
            param5.Value = phyDeatailsObject.EducationalQualification;
            SqlParameter param6 = new SqlParameter();
            param6.ParameterName = "@YearsOfExperience";
            param6.Value = phyDeatailsObject.YearsOfExperience;

            try
            {
                databaseObject.CommandToExecute.Connection = databaseObject.DatabaseConnection;

                databaseObject.DatabaseConnection.Open();

                databaseObject.CommandToExecute.Parameters.Add(param1);
                databaseObject.CommandToExecute.Parameters.Add(param2);
                databaseObject.CommandToExecute.Parameters.Add(param3);
                databaseObject.CommandToExecute.Parameters.Add(param4);
                databaseObject.CommandToExecute.Parameters.Add(param5);
                databaseObject.CommandToExecute.Parameters.Add(param6);

                return databaseObject.CommandToExecute.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                return 0;
            }
        }
        public int InsertPhysicianDetails(PhysicianDetails physicianDetailsObject)
        {
            int queryStatus = 0;

            databaseObject.CommandToExecute = new SqlCommand();

            databaseObject.CommandToExecute.CommandText = @"uspInsertPhysicianDetails";

            databaseObject.CommandToExecute.CommandType = CommandType.StoredProcedure;

            databaseObject.DBDataTable = new DataTable();
            databaseObject.DBDataTable.Columns.Add("PhysicianId", typeof(string));
            databaseObject.DBDataTable.Columns.Add("PhysicianFirstName", typeof(string));
            databaseObject.DBDataTable.Columns.Add("PhysicianLastName", typeof(string));
            databaseObject.DBDataTable.Columns.Add("DepartmentId", typeof(string));
            databaseObject.DBDataTable.Columns.Add("EducationalQualification", typeof(string));
            databaseObject.DBDataTable.Columns.Add("YearsOfExperience", typeof(int));
            databaseObject.DBDataTable.Columns.Add("PhysicianStateId", typeof(string));
            databaseObject.DBDataTable.Columns.Add("InsurancePlan", typeof(string));

            databaseObject.DBDataTable.Rows.Add(physicianDetailsObject.PhysicianId, physicianDetailsObject.PhysicianFirstName,
                                              physicianDetailsObject.PhysicianLastName, physicianDetailsObject.DepartmentId,
                                                physicianDetailsObject.EducationalQualification, physicianDetailsObject.YearsOfExperience,
                                                physicianDetailsObject.PhysicianStateId, physicianDetailsObject.InsurancePlan);
            param1 = new SqlParameter();

            param1.ParameterName = "@userPhysicianData";

            param1.Value = databaseObject.DBDataTable;

            param1.SqlDbType = SqlDbType.Structured;

            //SqlParameter param2 = new SqlParameter();
            //param2.ParameterName = "@physicianFirstName";
            //param2.Value = physicianDetailsObject.PhysicianFirstName;
            //SqlParameter param3 = new SqlParameter();
            //param3.ParameterName = "@physicianLastName";
            //param3.Value = physicianDetailsObject.PhysicianLastName;

            try
            {
                databaseObject.CommandToExecute.Connection = databaseObject.DatabaseConnection;

                databaseObject.DatabaseConnection.Open();

                databaseObject.CommandToExecute.Parameters.Add(param1);

                //databaseObject.CommandToExecute.Parameters.Add(param2);

                //databaseObject.CommandToExecute.Parameters.Add(param3);

                queryStatus = databaseObject.CommandToExecute.ExecuteNonQuery();

                return queryStatus;

            }
            catch (SqlException ex)
            {
                return queryStatus;
            }
            finally
            {
                databaseObject.DatabaseConnection.Close();
            }
        }
 public int InsertPhysicianDetails(PhysicianDetails physicianDetailsObject)
 {
     return PhysicianDetailsDALObject.InsertPhysicianDetails(physicianDetailsObject);
 }
 public string CheckNameOfPhysicianExists(PhysicianDetails physicianDetailsObject)
 {
     return PhysicianDetailsDALObject.CheckNameOfPhysicianExists(physicianDetailsObject);
 }
 public int UpdatePhysicianInfo(PhysicianDetails phyDeatailsObject)
 {
     return dBAccess.UpdatePhysicianInfo(phyDeatailsObject);
 }