public ProfessionalSchedule GetProfessionalSchedule(int professionalSchedulreId) { ProfessionalSchedule professionalSchedule = null; using (var conn = new SqlConnection(PrescienceRxConnectionString)) { conn.Open(); using (var cmd = new SqlCommand(UpdateProfessionalScheduleSp, conn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add("@ProfessionalScheduleId", SqlDbType.Int); cmd.Parameters["@ProfessionalScheduleId"].Value = professionalSchedulreId; using (var myReader = cmd.ExecuteReader()) { try { if (myReader.HasRows) { myReader.Read(); professionalSchedule = new ProfessionalSchedule(myReader); } } catch (Exception ex) { // TODO Logg Error here } } } } return professionalSchedule; }
//public List<KendoEntity> GetProfessionalMonthlyAppointments(int professionalId,int Month,int Year) //{ // ProfessionalSchedule professionalSchedule = null; // List<KendoEntity> lst = new List<KendoEntity>(); // using (var conn = new SqlConnection(PrescienceRxConnectionString)) // { // conn.Open(); // using (var cmd = new SqlCommand(GetProfessionalMonthlySchedule, conn)) // { // cmd.CommandType = System.Data.CommandType.StoredProcedure; // cmd.Parameters.Add("@ProfessionalId", SqlDbType.Int); // cmd.Parameters["@ProfessionalId"].Value = professionalId; // cmd.Parameters.Add("@Month", SqlDbType.Int); // cmd.Parameters["@Month"].Value = Month; // cmd.Parameters.Add("@Year", SqlDbType.Int); // cmd.Parameters["@Year"].Value = Year; // using (var myReader = cmd.ExecuteReader()) // { // try // { // if (myReader.HasRows) // { // while (myReader.Read()) // { // professionalSchedule = new ProfessionalSchedule(myReader, "Kendo"); // lst.Add(professionalSchedule.kendo); // } // } // } // catch (Exception ex) // { // // TODO Logg Error here // } // } // } // } // return lst; //} public List<KendoEntity> GetProfessionalMonthlyAppointments(int companyid, int professionalId, int Year, int customerId) { ProfessionalSchedule professionalSchedule = null; List<KendoEntity> lst = new List<KendoEntity>(); using (var conn = new SqlConnection(PrescienceRxConnectionString)) { conn.Open(); using (var cmd = new SqlCommand(GetProfessionalScheduleSp, conn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add("@ProfessionalId", SqlDbType.Int); cmd.Parameters["@ProfessionalId"].Value = professionalId; cmd.Parameters.Add("@CompanyId", SqlDbType.Int); cmd.Parameters["@CompanyId"].Value = companyid; cmd.Parameters.Add("@Year", SqlDbType.Int); cmd.Parameters["@Year"].Value = Year; cmd.Parameters.Add("@CustomerId", SqlDbType.Int); cmd.Parameters["@CustomerId"].Value = customerId; using (var myReader = cmd.ExecuteReader()) { try { if (myReader.HasRows) { while (myReader.Read()) { professionalSchedule = new ProfessionalSchedule(myReader, "Kendo"); lst.Add(professionalSchedule.kendo); } } } catch (Exception ex) { // TODO Logg Error here } } } } return lst; }