public Appointment(int appointmentid, Treatment name, Costumer costumers_Appointments, int totalsumtopay, DateTime dateandtime, bool payedforappointment, string employee) { this.appointmentID = appointmentid; this.name = name; this.costumers_Appointments = costumers_Appointments; this.totalsumtopay = name.GetPrice(); this.dateandtime = dateandtime; this.payedforappointment = payedforappointment; this.employee = employee; }
/*private static void init_cust_apoint() { foreach (Costumer c in Costumerslist) { c.getAllAppointments(); } }*/ public static void init_treatment()//מילוי המערך מתוך בסיס הנתונים { Treatmentslist = new List<Treatment>(); SqlCommand c = new SqlCommand(); c.CommandText = "EXECUTE dbo.Get_all_ListTreatments"; SQL_CON SC = new SQL_CON(); SqlDataReader rdr = SC.execute_query(c); while (rdr.Read()) { TreatmentTypes T = (TreatmentTypes)Enum.Parse(typeof(TreatmentTypes), rdr.GetValue(0).ToString()); Treatment t = new Treatment(T, int.Parse(rdr.GetValue(1).ToString()), int.Parse(rdr.GetValue(2).ToString())); Treatmentslist.Add(t); } }
public static void init_appointment()//מילוי המערך מתוך בסיס הנתונים { Appointmentslist = new List<Appointment>(); SqlCommand c = new SqlCommand(); c.CommandText = "EXECUTE dbo.Get_all_ListAppointments"; SQL_CON SC = new SQL_CON(); SqlDataReader rdr = SC.execute_query(c); while (rdr.Read()) { Costumer cr = seekCostumer(Convert.ToInt32(rdr.GetValue(2).ToString())); TreatmentTypes paa = (TreatmentTypes)Enum.Parse(typeof(TreatmentTypes), rdr.GetValue(1).ToString()); Treatment T = new Treatment(paa, getTreatmentLength(paa), getTreatmentPrice(paa)); Appointment api = new Appointment(int.Parse(rdr.GetValue(0).ToString()), T, cr, int.Parse(rdr.GetValue(3).ToString()), DateTime.Parse(rdr.GetValue(4).ToString()), false, rdr.GetValue(6).ToString()); Appointmentslist.Add(api); } }