public List <Appointment_Master> getallappoint() { SqlCommand cmd = new SqlCommand("User_Appointment_Master", Connection.Get()); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@uid", U_ID); SqlDataReader sdr = cmd.ExecuteReader(); List <Appointment_Master> appmasall = new List <Appointment_Master>(); while (sdr.Read()) { Appointment_Master d = new Appointment_Master(); d.Ap_ID = (int)sdr[0]; d.U_ID = (int)sdr[1]; d.E_ID = (int)sdr[2]; d.Date = (DateTime)sdr[3]; d.Status = (bool)sdr[4]; d.Bill = (decimal)sdr[5]; appmasall.Add(d); } sdr.Close(); Employee em = new Employee(); List <Employee> lst = em.all(); for (int i = 0; i < appmasall.Count; i++) { for (int j = 0; j < lst.Count; j++) { if (appmasall[i].E_ID == lst[j].E_ID) { appmasall[i].E_Name = lst[j].Name; } } } User u = new User(); List <User> uall = u.alluser(); for (int i = 0; i < appmasall.Count; i++) { for (int j = 0; j < uall.Count; j++) { if (appmasall[i].U_ID == uall[j].U_ID) { appmasall[i].U_Name = uall[j].Name; } } } return(appmasall); }
public List <Appointment_Master> allappbyuser(int a) { SqlCommand cmd = new SqlCommand("allappbyuser", Connection.Get()); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@uid", a); List <Appointment_Master> apall = new List <Appointment_Master>(); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { Appointment_Master ap = new Appointment_Master(); ap.Ap_ID = (int)sdr[0]; ap.E_Name = (string)sdr[1]; ap.Date = (DateTime)sdr[2]; ap.Status = (bool)sdr[3]; ap.Bill = (decimal)sdr[4]; apall.Add(ap); } sdr.Close(); return(apall); }