Пример #1
0
    protected void databind()
    {
        ViewState["Path"] = "~/admin_pages/default_pic.PNG";
        class_add_tutors cat = new class_add_tutors();

        ds1 = cat.select("select_all_subjects");
        if (ds1.Tables[0].Rows.Count > 0)
        {
            txt_sub.DataSource    = ds1.Tables[0];
            txt_sub.DataTextField = "sub_name";
            txt_sub.DataBind();
        }
        ds1 = cat.select("select_all_locations");
        if (ds1.Tables[0].Rows.Count > 0)
        {
            txt_loc.DataSource    = ds1.Tables[0];
            txt_loc.DataTextField = "loc_name";
            txt_loc.DataBind();
        }
        ds1 = cat.select("select_all_packages");
        if (ds1.Tables[0].Rows.Count > 0)
        {
            txt_pac.DataSource    = ds1.Tables[0];
            txt_pac.DataTextField = "pac_name";
            txt_pac.DataBind();
        }
        txt_class.DataSource = ar_class;
        txt_class.DataBind();
        txt_board.DataSource = ar_boards;
        txt_board.DataBind();
    }
Пример #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        selectedindices = txt_sub.GetSelectedIndices();
        subjects        = new string[selectedindices.Length];
        for (int x = 0; x < selectedindices.Length; x++)
        {
            subjects[x] = txt_sub.Items[selectedindices[x]].Text;
        }
        selectedindices = txt_loc.GetSelectedIndices();
        locations       = new string[selectedindices.Length];
        for (int x = 0; x < selectedindices.Length; x++)
        {
            locations[x] = txt_loc.Items[selectedindices[x]].Text;
        }
        selectedindices = txt_pac.GetSelectedIndices();
        packages        = new string[selectedindices.Length];
        for (int x = 0; x < selectedindices.Length; x++)
        {
            packages [x] = txt_pac.Items[selectedindices[x]].Text;
        }
        selectedindices = txt_board.GetSelectedIndices();
        boards          = new string[selectedindices.Length];
        for (int x = 0; x < selectedindices.Length; x++)
        {
            boards [x] = txt_board.Items[selectedindices[x]].Text;
        }
        selectedindices = txt_class.GetSelectedIndices();
        clas            = new string[selectedindices.Length];
        for (int x = 0; x < selectedindices.Length; x++)
        {
            clas[x] = txt_class.Items[selectedindices[x]].Text;
        }
        email = txt_email.Text;
        class_add_tutors cat = new class_add_tutors();
        int i = cat.check_duplicates(email);

        if (i == 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('There is already a tutor with this email')", true);
        }
        else
        {
            int j = cat.insert_tutor_details(txt_name.Text, txt_email.Text, txt_phone.Text, txt_status.SelectedItem.Text, ViewState["Path"].ToString(), txt_qualification.Text);
            if (j > 0)
            {
                int k = cat.insert_other_details(subjects, locations, packages, boards, clas, txt_email.Text);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Successfully Inserted')", true);

                // Response.Redirect("add_tutors.aspx");
            }
        }
    }
Пример #3
0
    private void databind()
    {
        class_add_tutors cls = new class_add_tutors();

        ds = cls.select_user_feedback();

        if (ds.Tables[0].Rows.Count > 0)
        {
            grd_list_tutors.DataSource = ds;
            grd_list_tutors.DataBind();
            lbl_error.Visible = false;
        }
        else
        {
            grd_list_tutors.DataSource = null;
            grd_list_tutors.DataBind();
            lbl_error.Visible = true;
        }
    }