Esempio n. 1
0
    protected void btn_add_Click11(object sender, EventArgs e)
    {
        class_list_locations cls = new class_list_locations();

        if (txt_name.Text != "" && txt_status.Text != "" && txt_pincode.Text != "")
        {
            ds = cls.select(txt_name.Text);
            if (ds.Tables[0].Rows.Count <= 0)
            {
                int i = cls.insert(txt_name.Text, txt_status.SelectedItem.Text.ToString(), txt_pincode.Text);
                if (i > 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record inserted successfully')", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record not inserted successfully')", true);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('This Location already in database')", true);
            }
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Fill The Details')", true);
        }
    }
Esempio n. 2
0
    protected void row_deleting(object sender, GridViewDeleteEventArgs e)
    {
        int id = Convert.ToInt32((grd_list_tutors.DataKeys[e.RowIndex].Value));
        class_list_locations cls2 = new class_list_locations();

        int i = cls2.delete(id);

        if (i > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record deleted successfully')", true);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record not deleted successfully')", true);
        }
        databind1();
    }
Esempio n. 3
0
    protected void ddl_reduce_SelectedIndexChanged1(object sender, EventArgs e)
    {
        string u = ddl_reduce.SelectedItem.Value;
        class_list_locations obj = new class_list_locations();

        ds = obj.showdata1(u);
        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;
        }
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            string a = ds.Tables[0].Rows[i]["loc_name"].ToString();
            int    o = obj.findtutors(ds.Tables[0].Rows[i].ItemArray[1].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[i].Cells[4].Text = "<a href='list_tutors.aspx?Loc_id=" + ds.Tables[0].Rows[i].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>"; //o.ToString();
            }
            else
            {
                grd_list_tutors.Rows[i].Cells[4].Text = "0";
            }
        }
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            string a = ds.Tables[0].Rows[i]["loc_name"].ToString();
            int    o = obj.findstudents(ds.Tables[0].Rows[i].ItemArray[1].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[i].Cells[5].Text = "<a href='list_students.aspx?Loc_id=" + ds.Tables[0].Rows[i].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>";
            }
            else
            {
                grd_list_tutors.Rows[i].Cells[5].Text = "0";
            }
        }
    }
Esempio n. 4
0
    protected void btn_search_Click1(object sender, EventArgs e)
    {
        string search            = txt_search.Text;
        class_list_locations obj = new class_list_locations();

        ds1 = obj.filter(search);
        if (ds1.Tables[0].Rows.Count > 0)
        {
            grd_list_tutors.DataSource = ds1;
            grd_list_tutors.DataBind();
            lbl_error.Visible = false;
        }
        else
        {
            grd_list_tutors.DataSource = null;
            grd_list_tutors.DataBind();
            lbl_error.Visible = true;
        }
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            string a = ds.Tables[0].Rows[i].ItemArray[1].ToString();
            int    o = obj.findtutors(ds.Tables[0].Rows[i].ItemArray[1].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[i].Cells[4].Text = "<a href='list_tutors.aspx?Loc_id=" + ds.Tables[0].Rows[i].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>"; //o.ToString();
            }
            else
            {
                grd_list_tutors.Rows[i].Cells[4].Text = "0";
            }
        }
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            string a = ds.Tables[0].Rows[i]["loc_name"].ToString();
            int    o = obj.findstudents(ds.Tables[0].Rows[i].ItemArray[1].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[i].Cells[5].Text = "<a href='list_students.aspx?Loc_id=" + ds.Tables[0].Rows[i].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>";
            }
            else
            {
                grd_list_tutors.Rows[i].Cells[5].Text = "0";
            }
        }
    }
Esempio n. 5
0
    protected void row_updating(object sender, GridViewUpdateEventArgs e)
    {
        int         id  = Convert.ToInt32((grd_list_tutors.DataKeys[e.RowIndex].Value));
        GridViewRow row = (GridViewRow)grd_list_tutors.Rows[e.RowIndex];

        TextBox              t1  = (TextBox)row.FindControl("txt_name");
        TextBox              t2  = (TextBox)row.FindControl("txt_pincode");
        RadioButtonList      t5  = (RadioButtonList)row.FindControl("rbl_status");
        class_list_locations cls = new class_list_locations();

        int i = cls.update(t1.Text, t5.SelectedItem.Text.ToString(), t2.Text, id);

        if (i > 0)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record updated successfully')", true);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record not updated successfully')", true);
        }
        grd_list_tutors.EditIndex = -1;

        databind1();
    }