コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Manager m = (Manager)Session["manager"];
         HelloLabel.Text = m.CManagerName;
         GetAllData.Appointment();
         AppointmentService ap         = new AppointmentService();
         string             whereclout = " WHERE DoctorId=ApointmentDoctorId and UserId=ApointmentUserId and HourNumber=ApointmentHour and ApointmentDay=DayId";
         string             order      = "";
         string             tabels     = "Apointment,Users,Hours,Doctors,Days";
         string             s          = "SELECT ApointmentId,ApointmentDoctorId,ApointmentUserId,ApointmentHour,ApointmentDate,UserName,HourNumber,HourStartTime,HourEndTime,DoctorName,DayName FROM " + tabels;
         s += whereclout;
         DataSet ds = ap.GetApointmentAndSort(s, tabels, order);
         //check if the dayaset isnt empty, if so, put the data in the gridview
         if (ds.Tables[0].Rows.Count != 0)
         {
             ShowAppointment.Visible    = true;
             ShowAppointment.DataSource = ds;
             ShowAppointment.DataBind();
         }
         else
         {
             Response.Write("<script>alert('לא נמצאו תורים')</script>");
         }
     }
 }
コード例 #2
0
    protected void SortDDL_SelectedIndexChanged(object sender, EventArgs e)
    {
        //init the visible of the gridview and the close button
        CloseAppointment.Visible = false;
        ShowAppointment.Visible  = false;
        int                x = SortDDL.SelectedIndex;
        DataSet            ds;
        AppointmentService ap = new AppointmentService();
        //create the SQL query
        string whereclout = " WHERE DoctorId=ApointmentDoctorId and UserId=ApointmentUserId and HourNumber=ApointmentHour and ApointmentDay=DayId";
        string order      = "";

        switch (x)
        {
        case 1:
        {
            order = " ORDER BY ApointmentDoctorId";
            break;
        }

        case 2:
        {
            order = " ORDER BY ApointmentUserId";
            break;
        }

        case 3:
        {
            order = " ORDER BY ApointmentDate";
            break;
        }
        }
        string tabels = "Apointment,Users,Hours,Doctors,Days";
        string s      = "SELECT ApointmentId,ApointmentDoctorId,ApointmentUserId,ApointmentHour,ApointmentDate,UserName,HourNumber,HourStartTime,HourEndTime,DoctorName,DayName FROM " + tabels;

        s += whereclout;
        ds = ap.GetApointmentAndSort(s, tabels, order);
        //check if the dayaset isnt empty, if so, put the data in the gridview
        if (ds.Tables[0].Rows.Count != 0)
        {
            ShowAppointment.Visible    = true;
            ShowAppointment.DataSource = ds;
            ShowAppointment.DataBind();
        }
        else
        {
            Response.Write("<script>alert('לא נמצאו תורים')</script>");
        }
    }
コード例 #3
0
        // GET: Appointment/Details/5
        public ActionResult Details(int id)
        {
            ShowAppointment     ViewModel = new ShowAppointment();
            string              url       = "appointmentdata/findappointment/" + id;
            HttpResponseMessage response  = client.GetAsync(url).Result;

            //Can catch the status code (200 OK, 301 REDIRECT), etc.
            //Debug.WriteLine(response.StatusCode);
            if (response.IsSuccessStatusCode)
            {
                //Put data into Appointment data transfer object
                AppointmentDto SelectedAppointment = response.Content.ReadAsAsync <AppointmentDto>().Result;
                ViewModel.Appointment = SelectedAppointment;

                //get the pet from the appointment
                url      = "Appointmentdata/getpetforappointment/" + id;
                response = client.GetAsync(url).Result;
                //Can catch the status code (200 OK, 301 REDIRECT), etc.
                //Debug.WriteLine(response.StatusCode);
                IEnumerable <PetDto> SelectedPets = response.Content.ReadAsAsync <IEnumerable <PetDto> >().Result;
                ViewModel.Pets = SelectedPets;

                //get the pet walker for the appointment
                url      = "teamdata/getpetwalkerforappointment/" + id;
                response = client.GetAsync(url).Result;
                //Can catch the status code (200 OK, 301 REDIRECT), etc.
                //Debug.WriteLine(response.StatusCode);
                //Put data into appointment data transfer object
                IEnumerable <PetWalkerDto> SelectedPetWalkers = response.Content.ReadAsAsync <IEnumerable <PetWalkerDto> >().Result;
                ViewModel.PetWalkers = SelectedPetWalkers;

                return(View(ViewModel));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
コード例 #4
0
    protected void SortAppointmentDDL_SelectedIndexChanged(object sender, EventArgs e)
    {
        ShowAppointment.Visible = false;
        int x = SortAppointmentDDL.SelectedIndex;

        if (x == 0)
        {
            return;
        }
        string   s = "", tabels = "Apointment,Users,Hours,Days", order = " ORDER BY ApointmentDate,ApointmentHour";
        string   whereclout = "";
        Doctor   doc        = (Doctor)Session["doctor"];
        DateTime d;

        //set the SQL query
        switch (x)
        {
        case 1:
        {
            whereclout = "and ApointmentDate<=#" + DateTime.Now.AddDays(1) + "#";
            break;
        }

        case 2:
        {
            d          = DateTime.Now.AddDays(7);
            whereclout = "and ApointmentDate<=#" + d + "#";
            break;
        }

        case 3:
        {
            d          = DateTime.Now.AddMonths(1);
            whereclout = "and ApointmentDate<=#" + d + "#";
            break;
        }

        case 4:
        {
            d          = DateTime.Now.AddYears(1);
            whereclout = "and ApointmentDate<=#" + d + "#";
            break;
        }
        }
        s  = "SELECT ApointmentId,ApointmentUserId,ApointmentHour,ApointmentDate,UserName,HourStartTime,HourEndTime,DayName FROM " + tabels;
        s += " WHERE ApointmentHour=HourNumber and ApointmentDoctorId='" + doc.CDoctorId + "' and ApointmentUserId=UserId and ApointmentDay=DayId " + whereclout;
        //get the data from the database
        AppointmentService appser = new AppointmentService();
        DataSet            ds     = appser.GetApointmentAndSort(s, tabels, order);

        //check if the dayaset isnt empty, if so, put the data in the gridview
        if (ds.Tables[0].Rows.Count != 0)
        {
            ShowAppointment.Visible    = true;
            ShowAppointment.DataSource = ds;
            ShowAppointment.DataBind();
        }
        else
        {
            Response.Write("<script>alert('לא נמצאו תורים')</script>");
        }
    }