Example #1
0
    protected void MemberIDChanged(object sender, EventArgs e)
    {
        txtCurrentBalance.Text = "";
        txtUtilization.Text    = "";
        txtRemarks.Text        = "";
        txtOldBalance.Text     = "";
        btnSave.Enabled        = true;
        string   memberid = txtID.Text.Trim();
        User     u        = new User();
        Business b        = new Business();

        u = b.findmembername(memberid);
        txtMembername.Text = u.membername;
        IncentiveBusiness B    = new IncentiveBusiness();
        IncentivePoint    obj  = new IncentivePoint();
        string            inst = Session["InstituteId"].ToString();
        string            role = Session["Role"].ToString();

        obj = B.SelectMemberCurBalanceInstitutewise(memberid, inst, role);
        if (obj.MemberId != null)
        {
            txtCurrentBalance.Text  = obj.CurrentBalance.ToString();
            txtOldBalance.Text      = obj.OpeningBalance.ToString();
            txtUtilizationDate.Text = DateTime.Now.ToShortDateString();

            string member     = txtmidSearch.Text.ToString();
            string membername = txtmnameSearch.Text.ToString();


            if (role == "7")
            {
                DataSet ds = B.SelectMembersInstitutewise(inst, memberid, u.membername);

                Panel1.Visible           = true;
                popGridSearch.DataSource = ds;
                popGridSearch.DataBind();
                popGridSearch.Visible = true;
                Panel4.Visible        = true;
            }
            else if (role == "17")
            {
                DataSet ds1 = B.SelectFacultyInstitutewise(inst, memberid, u.membername);
                Panel1.Visible           = true;
                popGridSearch.DataSource = ds1;
                popGridSearch.DataBind();
                popGridSearch.Visible = true;
                Panel4.Visible        = true;
            }
            else
            {
                DataSet ds2 = B.SelectStudentInstitutewise(inst, memberid, u.membername);
                if (u.MUNonMU != "M")
                {
                    Panel1.Visible           = true;
                    popGridSearch.DataSource = ds2;
                    popGridSearch.DataBind();
                    popGridSearch.Visible = true;
                    Panel4.Visible        = true;
                }
            }
            GridView2.Visible = true;
            Label1.Visible    = true;
        }

        DataTable dt = new DataTable();

        dt = B.CountUtilizationPoints(memberid);
        if (dt.Rows.Count > 0)
        {
            GridView2.Columns[2].FooterText = "Total";
            GridView2.Columns[3].FooterText = dt.Rows[0]["count1"].ToString();
            GridView2.Columns[4].FooterText = dt.Rows[0]["count2"].ToString();
            GridView2.DataSource            = dt;
            GridView2.DataBind();
        }
        else
        {
            GridView2.DataBind();
        }
    }