Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using RSosa_C40_A03.App_Code;
- using System.Diagnostics;
- using System.Data;
- using AjaxControlToolkit;
- public partial class MakeReservation : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- Customer customer;
- decimal custNum;
- if (Session["Customer"] != null)
- {
- customer = (Customer)(Session["Customer"]);
- custNum = customer.CustomerNumber;
- PetDAL cd = new PetDAL();
- DataTable dt = new DataTable();
- dt = cd.GetPetByCustNum(Convert.ToDecimal(custNum));
- AccordionPane[] apArray = new AccordionPane[dt.Rows.Count];
- Table[] petTables = new Table[dt.Rows.Count];
- CheckBox[] chkBoarding = new CheckBox[dt.Rows.Count];
- TextBox[] txtWalk = new TextBox[dt.Rows.Count];
- TextBox[] txtGrooming = new TextBox[dt.Rows.Count];
- TextBox[] txtPlaytime = new TextBox[dt.Rows.Count];
- TextBox[] txtMedName = new TextBox[dt.Rows.Count];
- TextBox[] txtMedDosage = new TextBox[dt.Rows.Count];
- TextBox[] txtFoodFreq = new TextBox[dt.Rows.Count];
- TextBox[] txtFoodQuan = new TextBox[dt.Rows.Count];
- DropDownList[] ddlBrand = new DropDownList[dt.Rows.Count];
- Label[] lblBoarding = new Label[dt.Rows.Count];
- Label[] lblWalk = new Label[dt.Rows.Count];
- Label[] lblGrooming = new Label[dt.Rows.Count];
- Label[] lblPlaytime = new Label[dt.Rows.Count];
- Label[] lblMed = new Label[dt.Rows.Count];
- Label[] lblMedName = new Label[dt.Rows.Count];
- Label[] lblMedDosage = new Label[dt.Rows.Count];
- Label[] lblFood = new Label[dt.Rows.Count];
- Label[] lblFoodFreq = new Label[dt.Rows.Count];
- Label[] lblFoodQuan = new Label[dt.Rows.Count];
- Label[] lblFoodBrand = new Label[dt.Rows.Count];
- Label[] lblTitle = new Label[dt.Rows.Count];
- for (int i = 0; i < dt.Rows.Count; ++i)
- {
- apArray[i] = new AccordionPane();
- apArray[i].ID = "appArray" + i;
- petTables[i] = new Table();
- chkBoarding[i] = new CheckBox();
- txtWalk[i] = new TextBox();
- txtGrooming[i] = new TextBox();
- txtPlaytime[i] = new TextBox();
- txtMedName[i] = new TextBox();
- txtMedDosage[i] = new TextBox();
- txtFoodFreq[i] = new TextBox();
- txtFoodQuan[i] = new TextBox();
- ddlBrand[i] = new DropDownList();
- lblTitle[i] = new Label();
- lblBoarding[i] = new Label();
- lblBoarding[i].Text = "Boarding";
- lblWalk[i] = new Label();
- lblWalk[i].Text = "Walking Frequency";
- lblGrooming[i] = new Label();
- lblGrooming[i].Text = "Grooming Frequency";
- lblPlaytime[i] = new Label();
- lblPlaytime[i].Text = "Playtime Frequency";
- lblMed[i] = new Label();
- lblMed[i].Text = "Medication";
- lblMedName[i] = new Label();
- lblMedName[i].Text = "Name";
- lblMedDosage[i] = new Label();
- lblMedDosage[i].Text = "Dosage";
- lblFood[i] = new Label();
- lblFood[i].Text = "Food";
- lblFoodFreq[i] = new Label();
- lblFoodFreq[i].Text = "Frequency";
- lblFoodQuan[i] = new Label();
- lblFoodQuan[i].Text = "Quantity";
- lblFoodBrand[i] = new Label();
- lblFoodBrand[i].Text = "Brand";
- }
- for (int i = 0; i < dt.Rows.Count; ++i)
- {
- DropDownList1.Items.Add(dt.Rows[i]["pet_name"].ToString());
- DropDownList1.Items[i].Value = dt.Rows[i]["pet_number"].ToString();
- lblTitle[i].Text = dt.Rows[i]["pet_name"].ToString();
- apArray[i].HeaderContainer.Controls.Add(lblTitle[i]);
- petTables[i].CssClass = "petReservationTable";
- TableRow[] rows = new TableRow[8];
- for (int n = 0; n < 8; ++n)
- {
- rows[n] = new TableRow();
- }
- TableCell[] cells = new TableCell[20];
- for (int n = 0; n < 20; ++n)
- {
- cells[n] = new TableCell();
- }
- cells[0].Controls.Add(lblBoarding[i]);
- cells[1].Controls.Add(chkBoarding[i]);
- cells[2].Controls.Add(lblWalk[i]);
- cells[3].Controls.Add(txtWalk[i]);
- cells[4].Controls.Add(lblGrooming[i]);
- cells[5].Controls.Add(txtGrooming[i]);
- cells[6].Controls.Add(lblPlaytime[i]);
- cells[7].Controls.Add(txtPlaytime[i]);
- cells[8].Controls.Add(lblMed[i]);
- cells[9].Controls.Add(lblMedName[i]);
- cells[10].Controls.Add(txtMedName[i]);
- cells[11].Controls.Add(lblMedDosage[i]);
- cells[12].Controls.Add(txtMedDosage[i]);
- cells[13].Controls.Add(lblFood[i]);
- cells[14].Controls.Add(lblFoodFreq[i]);
- cells[15].Controls.Add(txtFoodFreq[i]);
- cells[16].Controls.Add(lblFoodQuan[i]);
- cells[17].Controls.Add(txtFoodQuan[i]);
- cells[18].Controls.Add(lblFoodBrand[i]);
- cells[19].Controls.Add(ddlBrand[i]);
- rows[0].Cells.Add(cells[0]);
- rows[0].Cells.Add(cells[1]);
- rows[1].Cells.Add(cells[2]);
- rows[1].Cells.Add(cells[3]);
- rows[2].Cells.Add(cells[4]);
- rows[2].Cells.Add(cells[5]);
- rows[3].Cells.Add(cells[6]);
- rows[3].Cells.Add(cells[7]);
- rows[4].Cells.Add(cells[8]);
- rows[5].Cells.Add(cells[9]);
- rows[5].Cells.Add(cells[10]);
- rows[5].Cells.Add(cells[11]);
- rows[5].Cells.Add(cells[12]);
- rows[6].Cells.Add(cells[13]);
- rows[7].Cells.Add(cells[14]);
- rows[7].Cells.Add(cells[15]);
- rows[7].Cells.Add(cells[16]);
- rows[7].Cells.Add(cells[17]);
- rows[7].Cells.Add(cells[18]);
- rows[7].Cells.Add(cells[19]);
- petTables[i].Rows.AddAt(0, rows[0]);
- petTables[i].Rows.AddAt(1, rows[1]);
- petTables[i].Rows.AddAt(2, rows[2]);
- petTables[i].Rows.AddAt(3, rows[3]);
- petTables[i].Rows.AddAt(4, rows[4]);
- petTables[i].Rows.AddAt(5, rows[5]);
- petTables[i].Rows.AddAt(6, rows[6]);
- petTables[i].Rows.AddAt(7, rows[7]);
- apArray[i].ContentContainer.Controls.Add(petTables[i]);
- Accordion1.Panes.Add(apArray[i]);
- }
- }
- }
- protected void btnAccount_Click(object sender, EventArgs e)
- {
- Response.Redirect("OverviewEmployee.aspx");
- }
- protected void cvStartDate_ServerValidate(object source, ServerValidateEventArgs args)
- {
- DateTime startdate;
- startdate = DateTime.ParseExact(txtStartDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
- if (startdate >= DateTime.Now)
- args.IsValid = true;
- else
- args.IsValid = false;
- }
- protected void cvEndDate_ServerValidate(object source, ServerValidateEventArgs args)
- {
- DateTime startdate;
- startdate = DateTime.ParseExact(txtStartDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
- DateTime enddate;
- enddate = DateTime.ParseExact(txtEndDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
- if (enddate >= startdate)
- args.IsValid = true;
- else
- args.IsValid = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement