Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.conn = (DBconnector.Connector)Session["connector"];

        DataTable dt = new DataTable();

        this.conn.GetAudit(dt);

        GridViewData.DataSource = dt;
        GridViewData.DataBind();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.conn = (DBconnector.Connector)Session["connector"];
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.conn = (DBconnector.Connector)Session["connector"];
        bool update = false;
        DataTable dt = null;
        string type = "";
        string sin = "";

        if (Request.QueryString["type"] != null && Request.QueryString["sin"] != null)
        {
            update = true;

            type = Request.QueryString["type"];
            sin = Request.QueryString["sin"];

            if (type == "fulltime")
            {
                ddlEmployeeType.SelectedIndex = 2;
            }
            else if (type == "parttime")
            {
                ddlEmployeeType.SelectedIndex = 3;
            }
            else if (type == "seasonal")
            {
                ddlEmployeeType.SelectedIndex = 4;
            }

            dt = new DataTable();

            this.conn.GetEmployee(type, sin, dt);

            Session["modify"] = "y";
        }

        PanelDetails.Controls.Clear();

        if (ddlEmployeeType.SelectedIndex == 1)
        {
            Label labelHire = new Label();

            labelHire.Text = "Date Of Hire: ";

            TextBox textHire = new TextBox();
            textHire.ID = "hire";
            textHire.TextMode = TextBoxMode.Date;
            TextBox textTerm = new TextBox();

            PanelDetails.Controls.Add(labelHire);
            PanelDetails.Controls.Add(textHire);
            PanelDetails.Controls.Add(new LiteralControl("<br />"));
        }
        else if (ddlEmployeeType.SelectedIndex == 2)
        {
            Label labelHire = new Label();
            Label labelTerm = new Label();

            labelHire.Text = "Date Of Hire: ";

            TextBox textHire = new TextBox();
            textHire.ID = "hire";
            textHire.TextMode = TextBoxMode.Date;

            PanelDetails.Controls.Add(labelHire);
            PanelDetails.Controls.Add(textHire);
            PanelDetails.Controls.Add(new LiteralControl("<br />"));
        }
        else if (ddlEmployeeType.SelectedIndex == 3)
        {
            Label labelHire = new Label();
            Label labelReason = new Label();
            Label labelPayment = new Label();
            Label labelYear = new Label();

            labelHire.Text = "Season: ";
            labelYear.Text = "Season Year: ";

            TextBox textHire = new TextBox();
            textHire.ID = "hire";
            TextBox textYear = new TextBox();
            textYear.ID = "year";
            textYear.TextMode = TextBoxMode.Number;

            PanelDetails.Controls.Add(labelHire);
            PanelDetails.Controls.Add(textHire);
            PanelDetails.Controls.Add(new LiteralControl("<br />"));

            PanelDetails.Controls.Add(labelYear);
            PanelDetails.Controls.Add(textYear);
            PanelDetails.Controls.Add(new LiteralControl("<br />"));

        }

        if (update)
        {
            if (type == "fulltime")
            {
                txtCompany.Text = dt.Rows[0]["CompanyName"].ToString();
                object tmp = dt.Rows[0]["DateOfBirth"];
                if (tmp.ToString() != "")
                {
                    txtDateOfBirth.Text = ((DateTime)dt.Rows[0]["DateOfBirth"]).ToString("yyyy-MM-dd");
                }
                txtFirstName.Text = dt.Rows[0]["FirstName"].ToString();
                txtLastName.Text = dt.Rows[0]["LastName"].ToString();
                txtSIN.Text = sin;

                TextBox textHire = null;
                foreach (Control cont in PanelDetails.Controls)
                {
                    if (cont is TextBox)
                    {
                        if (cont.ID == "hire")
                        {
                            textHire = (TextBox)cont;
                            continue;
                        }
                    }
                }

                tmp = dt.Rows[0]["DateOfHire"];
                if (tmp.ToString() != "")
                {
                    textHire.Text = ((DateTime)dt.Rows[0]["DateOfHire"]).ToString("yyyy-MM-dd");
                }

            }
            else if (type == "parttime")
            {
                txtCompany.Text = dt.Rows[0]["CompanyName"].ToString();
                object tmp = dt.Rows[0]["DateOfBirth"];
                if (tmp.ToString() != "")
                {
                    txtDateOfBirth.Text = ((DateTime)dt.Rows[0]["DateOfBirth"]).ToString("yyyy-MM-dd");
                }
                txtFirstName.Text = dt.Rows[0]["FirstName"].ToString();
                txtLastName.Text = dt.Rows[0]["LastName"].ToString();
                txtSIN.Text = sin;

                TextBox textHire = null;
                foreach (Control cont in PanelDetails.Controls)
                {
                    if (cont is TextBox)
                    {
                        if (cont.ID == "hire")
                        {
                            textHire = (TextBox)cont;
                            continue;
                        }
                    }
                }

                tmp = dt.Rows[0]["DateOfHire"];
                if (tmp.ToString() != "")
                {
                    textHire.Text = ((DateTime)dt.Rows[0]["DateOfHire"]).ToString("yyyy-MM-dd");
                }

            }
            else if (type == "seasonal")
            {
                txtCompany.Text = dt.Rows[0]["CompanyName"].ToString();
                object tmp = dt.Rows[0]["DateOfBirth"];
                if (tmp.ToString() != "")
                {
                    txtDateOfBirth.Text = ((DateTime)dt.Rows[0]["DateOfBirth"]).ToString("yyyy-MM-dd");
                }
                txtFirstName.Text = dt.Rows[0]["FirstName"].ToString();
                txtLastName.Text = dt.Rows[0]["LastName"].ToString();
                txtSIN.Text = sin;

                TextBox textHire = null;
                TextBox textYear = null;
                foreach (Control cont in PanelDetails.Controls)
                {
                    if (cont is TextBox)
                    {
                        if (cont.ID == "hire")
                        {
                            textHire = (TextBox)cont;
                            continue;
                        }
                        else if (cont.ID == "year")
                        {
                            textYear = (TextBox)cont;
                            continue;
                        }
                    }
                }

                string season = dt.Rows[0]["Season"].ToString();
                if (season != "")
                {
                    textYear.Text = season.Substring(season.Length - 4);
                    textHire.Text = season.Substring(0, season.Length - 4);
                }
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.conn = (DBconnector.Connector)Session["connector"];
     DataTable mondays = new DataTable();
     LabelComment.Text = conn.GetMondays("2012-01-01", mondays);
     DropDownListMondays.DataSource = mondays;
     DropDownListMondays.DataTextField = "MonDates";
     DropDownListMondays.DataValueField = "MonDates";
     DropDownListMondays.DataBind();
 }