Пример #1
0
        protected void btnsearch_Click(object sender, EventArgs e)
        {
            int      userid  = 0;
            string   fname   = "";
            string   lname   = "";
            string   usename = "";
            string   email   = "";
            string   phone   = "";
            string   answer  = "";
            string   type    = "";
            string   status  = "";
            DateTime datestemp;

            if (DropDownListuserid.SelectedValue == "%")
            {
                userid = 0;
            }
            else
            {
                userid = Convert.ToInt32(DropDownListuserid.SelectedValue);
            }
            if (DropDownListfirstname.SelectedValue == "%")
            {
                fname = "";
            }
            else
            {
                fname = DropDownListfirstname.SelectedValue;
            }
            if (DropDownListlastname.SelectedValue == "%")
            {
                lname = "";
            }
            else
            {
                lname = DropDownListlastname.SelectedValue;
            }

            if (DropDownListusername.SelectedValue == "%")
            {
                usename = "";
            }
            else
            {
                usename = DropDownListusername.SelectedValue;
            }

            if (DropDownListrecoveryemail.SelectedValue == "%")
            {
                email = "";
            }
            else
            {
                email = DropDownListrecoveryemail.SelectedValue;
            }

            if (DropDownListphoneno.SelectedValue == "%")
            {
                phone = "";
            }
            else
            {
                phone = DropDownListphoneno.SelectedValue;
            }
            if (DropDownListSecurityAns.SelectedValue == "%")
            {
                answer = "";
            }
            else
            {
                answer = DropDownListSecurityAns.SelectedValue;
            }
            if (DropDownListusertype.SelectedValue == "%")
            {
                type = "";
            }
            else
            {
                type = DropDownListusertype.SelectedValue;
            }

            if (DropDownListuserstatus.SelectedValue == "%")
            {
                status = "";
            }
            else
            {
                status = DropDownListuserstatus.SelectedValue.Trim();
            }
            //string MYNEWDate = string.Empty;
            //if (DropDownListdatestamp.SelectedValue != "%")
            //{
            //    datestemp = Convert.ToDateTime(DropDownListdatestamp.SelectedValue);
            //    //DateTime myDateTime = DateTime.Now;
            //    MYNEWDate = datestemp.ToString("yyyy-MM-dd HH:mm:ss:fff");
            //}
            //else
            //{
            //    datestemp = DateTime.Now;
            //    MYNEWDate = datestemp.ToString("yyyy-MM-dd HH:mm:ss:fff");
            //}


            // dsfilter = loginDA.fetchreportsbyfilter(userid, DropDownListfirstname.SelectedValue, DropDownListlastname.SelectedValue,DropDownListusername.SelectedValue,DropDownListphoneno.SelectedValue,DropDownListrecoveryemail.SelectedValue,DropDownListSecurityAns.SelectedValue,DropDownListusertype.SelectedValue,DropDownListuserstatus.SelectedValue);

            dsfilter = loginDA.fetchreportsbyfilter(userid, fname, lname, usename, phone, email, answer, type, status);

            if (dsfilter.Tables[0].Rows.Count > 0)
            {
                GridView1.DataSource = dsfilter;
                GridView1.DataBind();
            }
            else
            {
                BindGridviewdata();
            }
        }