Example #1
0
    protected void Btnsearch_Click(object sender, EventArgs e)
    {
        lbl1.Visible      = true;
        Panel1.Visible    = true;
        Panel3.Visible    = true;
        Gridview.Visible  = true;
        GridView1.Visible = true;
        IncentiveBusiness obj         = new IncentiveBusiness();
        string            membertype  = obj.SelectMemberType(txtEmployeecode.Text.Trim());
        string            institution = obj.CheckInstitution(txtEmployeecode.Text.Trim());
        string            role        = Session["Role"].ToString();
        string            user        = Session["UserId"].ToString();
        ArrayList         rolelist    = new ArrayList();

        rolelist = obj.SelectCountOfRole(user);
        if (rolelist.Contains(18))
        {
            if (membertype != "M")
            {
                if (institution == Session["InstituteId"].ToString())
                {
                    GridviewStudent.DataBind();
                    GridviewStudent.Visible = true;
                    GridView1.Visible       = true;
                    Gridview.Visible        = false;
                    PanelPRAISE.Visible     = true;
                    Panel5.Visible          = false;
                }
                else
                {
                    Panel1.Visible          = false;
                    GridviewStudent.Visible = false;
                    Gridview.Visible        = false;
                    Panel1.Visible          = false;
                    GridviewStudent.Visible = false;
                    PanelPRAISE.Visible     = false;
                    Panel5.Visible          = false;
                    GridView5.Visible       = false;
                    lbl5.Visible            = false;
                    Panel3.Visible          = false;
                }
                if (institution == Session["InstituteId"].ToString())
                {
                    DataTable dt = new DataTable();
                    dt = obj.CountRemainingPoints(txtEmployeecode.Text);
                    if (dt.Rows.Count > 0)
                    {
                        GridView1.Columns[2].FooterText = "Total";
                        GridView1.Columns[3].FooterText = dt.Rows[0]["count1"].ToString();
                        GridView1.Columns[4].FooterText = dt.Rows[0]["count2"].ToString();
                        GridView1.DataSource            = dt;
                        GridView1.DataBind();
                        GridView1.Visible = true;
                    }
                    {
                        GridView1.Visible = true;
                        GridView1.DataBind();
                    }
                }
                else
                {
                    Gridview.Visible        = false;
                    Panel1.Visible          = false;
                    GridviewStudent.Visible = false;
                    PanelPRAISE.Visible     = false;
                    Panel5.Visible          = false;
                    GridView5.Visible       = false;
                    lbl5.Visible            = false;
                    Panel1.Visible          = false;
                    Panel3.Visible          = false;
                    GridviewStudent.Visible = false;
                }
            }
            else
            {
                Gridview.Visible  = false;
                GridView1.Visible = false;
            }
        }
        else if (rolelist.Contains(17))
        {
            if (membertype != "S")
            {
                if (institution == Session["InstituteId"].ToString())
                {
                    GridviewStudent.Visible = false;
                    Gridview.Visible        = true;
                    PanelPRAISE.Visible     = false;
                    Panel5.Visible          = true;
                    GridView5.Visible       = true;
                    lbl5.Visible            = true;
                }
                else
                {
                    Gridview.Visible        = false;
                    Panel1.Visible          = false;
                    GridviewStudent.Visible = false;
                    PanelPRAISE.Visible     = false;
                    Panel5.Visible          = false;
                    GridView5.Visible       = false;
                    lbl5.Visible            = false;
                    Panel1.Visible          = false;
                    Panel3.Visible          = false;
                    GridviewStudent.Visible = false;
                }
            }
            else
            {
                Gridview.Visible  = false;
                GridView1.Visible = false;
            }
        }
        else if ((rolelist.Contains(19)) || rolelist.Contains(7))
        {
            if (membertype == "S")
            {
                if (institution == Session["InstituteId"].ToString())
                {
                    GridviewStudent.DataBind();
                    GridviewStudent.Visible = true;
                    GridView1.Visible       = true;
                    Gridview.Visible        = false;
                    PanelPRAISE.Visible     = true;
                    Panel5.Visible          = false;
                }
                else
                {
                    Panel1.Visible          = false;
                    GridviewStudent.Visible = false;
                    Gridview.Visible        = false;
                    Panel1.Visible          = false;
                    GridviewStudent.Visible = false;
                    PanelPRAISE.Visible     = false;
                    Panel5.Visible          = false;
                    GridView5.Visible       = false;
                    lbl5.Visible            = false;
                    Panel3.Visible          = false;
                }
            }
            else
            {
                if (institution == Session["InstituteId"].ToString())
                {
                    GridviewStudent.Visible = false;
                    Gridview.Visible        = true;
                    PanelPRAISE.Visible     = false;
                    Panel5.Visible          = true;
                    GridView5.Visible       = true;
                    lbl5.Visible            = true;
                }
                else
                {
                    Gridview.Visible        = false;
                    Panel1.Visible          = false;
                    GridviewStudent.Visible = false;
                    PanelPRAISE.Visible     = false;
                    Panel5.Visible          = false;
                    GridView5.Visible       = false;
                    lbl5.Visible            = false;
                    Panel1.Visible          = false;
                    Panel3.Visible          = false;
                    GridviewStudent.Visible = false;
                }
            }
            if (institution == Session["InstituteId"].ToString())
            {
                DataTable dt = new DataTable();
                dt = obj.CountRemainingPoints(txtEmployeecode.Text);
                if (dt.Rows.Count > 0)
                {
                    GridView1.Columns[2].FooterText = "Total";
                    GridView1.Columns[3].FooterText = dt.Rows[0]["count1"].ToString();
                    GridView1.Columns[4].FooterText = dt.Rows[0]["count2"].ToString();
                    GridView1.DataSource            = dt;
                    GridView1.DataBind();
                    GridView1.Visible = true;
                }
                {
                    GridView1.Visible = true;
                    GridView1.DataBind();
                }
            }
            else
            {
                Gridview.Visible        = false;
                Panel1.Visible          = false;
                GridviewStudent.Visible = false;
                PanelPRAISE.Visible     = false;
                Panel5.Visible          = false;
                GridView5.Visible       = false;
                lbl5.Visible            = false;
                Panel1.Visible          = false;
                Panel3.Visible          = false;
                GridviewStudent.Visible = false;
            }
        }
        else
        {
            //if (Session["Role"].ToString() == "11")
            //{
            table.Visible           = false;
            txtEmployeecode.Text    = Session["UserId"].ToString();
            txtEmployeecode.Visible = false;
            lbl1.Visible            = true;
            Panel1.Visible          = true;
            Panel3.Visible          = true;
            Panel5.Visible          = true;
            lbl5.Visible            = true;
            Gridview.Visible        = true;
            GridView1.Visible       = true;
            GridView5.Visible       = true;
            table1.Visible          = true;
            GridviewStudent.Visible = false;
            PanelPRAISE.Visible     = false;
            lblnote.Text            = "Note: For any queries please contact Directorate of Research ([email protected])";
            //IncentiveBusiness obj = new IncentiveBusiness();
            DataTable dt = new DataTable();
            dt = obj.CountRemainingPoints(txtEmployeecode.Text);
            if (dt.Rows.Count > 0)
            {
                GridView1.Columns[2].FooterText = "Total";
                GridView1.Columns[3].FooterText = dt.Rows[0]["count1"].ToString();
                GridView1.Columns[4].FooterText = dt.Rows[0]["count2"].ToString();
                GridView1.DataSource            = dt;
                GridView1.DataBind();
            }
            {
                GridView1.DataBind();
            }
        }
        //else
        //{
        //    table.Visible = true;
        //    txtEmployeecode.Text = "";
        //    lbl1.Visible = false;
        //    Panel1.Visible = false;
        //    Panel3.Visible = false;
        //    Panel5.Visible = true;
        //    lbl5.Visible = true;
        //    //IncentiveBusiness obj = new IncentiveBusiness();
        //    string membertype1 = obj.SelectMemberType(txtEmployeecode.Text.Trim());
        //    if (membertype1 == "S")
        //    {
        //        GridviewStudent.Visible = true;
        //    }
        //    else
        //    {
        //        Gridview.Visible = false;
        //    }
        //    Gridview.Visible = false;
        //    GridView1.Visible = false;
        //    GridView5.Visible = true;
        //}
    }