コード例 #1
0
    protected void btn_add_Click11(object sender, EventArgs e)
    {
        class_list_package cls = new class_list_package();

        if (txt_name.Text != "" && txt_status.Text != "" && txt_validity.Text != "" && txt_cost.Text != "" && txt_leads.Text != "")
        {
            ds = cls.select(txt_name.Text);
            if (ds.Tables[0].Rows.Count <= 0)
            {
                int i = cls.insert(txt_name.Text, txt_validity.Text, txt_leads.Text, txt_cost.Text, txt_status.SelectedItem.Text.ToString());
                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 Package already in database')", true);
            }
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Fill The Details')", true);
        }
    }
コード例 #2
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_validity");
        TextBox t3 = (TextBox)row.FindControl("txt_totalleads");
        TextBox t4 = (TextBox)row.FindControl("txt_cost");

        RadioButtonList    t5  = (RadioButtonList)row.FindControl("rbl_status");
        class_list_package cls = new class_list_package();

        int i = cls.update(t1.Text, t2.Text, t3.Text, t4.Text, t5.SelectedItem.Text.ToString(), 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();
    }
コード例 #3
0
    protected void btn_search_Click1(object sender, EventArgs e)
    {
        string             search = txt_search.Text;
        class_list_package obj    = new class_list_package();

        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 < ds1.Tables[0].Rows.Count; i++)
        {
            string a = ds1.Tables[0].Rows[i].ItemArray[1].ToString();
            int    o = obj.findtutors(ds1.Tables[0].Rows[i].ItemArray[1].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_tutors.aspx?pac_id=" + ds1.Tables[0].Rows[i].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>";
            }
            else
            {
                grd_list_tutors.Rows[i].Cells[6].Text = "0";
            }
        }
    }
コード例 #4
0
    protected void ddl_reduce_SelectedIndexChanged1(object sender, EventArgs e)
    {
        string             u   = ddl_reduce.SelectedItem.Value;
        class_list_package obj = new class_list_package();

        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].ItemArray[1].ToString();
            int    o = obj.findtutors(ds.Tables[0].Rows[i].ItemArray[1].ToString());
            if (o > 0)
            {
                grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_tutors.aspx?pac_id=" + ds.Tables[0].Rows[i].ItemArray[0].ToString() + "'>" + o.ToString() + "</a>";
            }
            else
            {
                grd_list_tutors.Rows[i].Cells[6].Text = "0";
            }
        }
    }
コード例 #5
0
    protected void row_deleting(object sender, GridViewDeleteEventArgs e)
    {
        int id = Convert.ToInt32((grd_list_tutors.DataKeys[e.RowIndex].Value));
        class_list_package cls2 = new class_list_package();

        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();
    }