Beispiel #1
0
 protected void btnShow_Click(object sender, EventArgs e)
 {
     if (ddlExamSession.SelectedIndex == 0 || ddlExamYear.SelectedIndex == 0 || txtrollno.Text == "")
     {
         AlertWarning.Visible = true;
     }
     else
     {
         plimg.Ind         = 50;
         plimg.ExamSession = Convert.ToInt32(ddlExamSession.SelectedIndex);
         plimg.Examyear    = Convert.ToInt32(ddlExamYear.SelectedItem.Text);
         plimg.RollNo      = Convert.ToInt32(txtrollno.Text);
         dt = blimg.SearchStudentDetail(plimg);
         if (dt != null)
         {
             GridStudentDetail.DataSource = Session["dtSession"] = dt;
             GridStudentDetail.DataBind();
             pnlstudentDetail.Visible = true;
             //AlertRecordNotF.Visible = AlertWarning.Visible = false;
             //divImage.Visible = true;
             //ImageCF.ImageUrl = dt.Rows[0]["PartBImagePath"].ToString();
             //ImageFoil.ImageUrl = dt.Rows[0]["PartAImagePath"].ToString();
         }
         else
         {
             AlertRecordNotF.Visible = true;
         }
     }
 }
    private void Clear()
    {
        if (DDLExamSession.SelectedIndex > 0)
        {
            DDLExamSession.SelectedIndex = 0;
        }
        if (DDLExamYear.SelectedIndex > 0)
        {
            DDLExamYear.SelectedIndex = 0;
        }
        if (DDLApply.SelectedIndex > 0)
        {
            DDLApply.SelectedIndex = 0;
        }

        TxtStuName.Text              = txtRollNo.Text = TxtRmark.Text = lblSms.Text = txtRecieptNo.Text = txtRecieptAmt.Text =
            txtRecieptDate.Text      = TxtRmark.Text = "";
        DDLApply.Enabled             = DDLExamSession.Enabled = DDLExamYear.Enabled = TxtRmark.Enabled = TxtStuName.Enabled = txtRollNo.Enabled = true;
        GridStudentDetail.DataSource = null;
        GridStudentDetail.DataBind();
        Panel1.Visible      = false;
        LblSearchCount.Text = "";
        FoilImgPath         = CFImgPath = "";

        DDLExamYear.Focus();
        //Response.Redirect("FrmStudentDetail.aspx");
    }
    private void SearchDetail()   // Search Detail Purpose
    {
        try
        {
            lblSms.Text = "";

            string rollno;
            if (txtRollNo.Text.Trim() == "")
            {
                rollno = "0";
            }
            else
            {
                rollno = Convert.ToString(txtRollNo.Text.Trim());
            }

            HttpClient HClient = new HttpClient();
            HClient.BaseAddress = new Uri(DataAcces.Url);
            HClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            objplstudentDetail = new PlStudentDetail();

            var uri      = string.Format("api/StudentDetail/GetStudentDetail/?ind={0}&ExamYear={1}&ExamSession={2}&StudentName={3}&Rollno={4}", 2, DDLExamYear.SelectedItem.ToString(), DDLExamSession.SelectedValue.ToString(), TxtStuName.Text.Trim(), rollno);
            var response = HClient.GetAsync(uri).Result;
            if (response.IsSuccessStatusCode)
            {
                //var getdata = response.Content.ReadAsAsync<IEnumerable<PlStudentDetail>>().Result;
                var getdata = response.Content.ReadAsAsync <DataTable>().Result;
                if (getdata.Rows.Count > 0)
                {
                    LblSearchCount.Text  = "Total Searched Records : " + getdata.Rows.Count;
                    Session["dtSession"] = getdata;

                    Panel1.Visible = true;
                    GridStudentDetail.DataSource = getdata;
                    GridStudentDetail.DataBind();

                    DDLApply.Enabled       = false;
                    DDLExamSession.Enabled = false;
                    DDLExamYear.Enabled    = false;
                    TxtRmark.Enabled       = true;
                    TxtStuName.Enabled     = false;
                    txtRollNo.Enabled      = false;

                    foreach (DataRow a in getdata.Rows)
                    {
                        objplstudetail.ExamName       = Convert.ToString(a["Faculty_Exam_Name"]);
                        objplstudetail.PartAImagePath = Convert.ToString(a["PartAImagePath"]);
                        // if (a["PartARegNo"] != null || a["PartARegNo"] != "")
                        objplstudetail.PartARegNo     = Convert.ToInt32(a["PartARegNo"]);
                        objplstudetail.PartBImagePath = Convert.ToString(a["PartBImagePath"]);
                        // if (a["PartBRegNo"] != null || a["PartBRegNo"] != "")
                        objplstudetail.PartBRegNo = Convert.ToInt32(a["PartBRegNo"]);

                        objplstudetail.Rollno = Convert.ToString(a["Rollno"]);
                        objplstudetail.SName  = Convert.ToString(a["SName"]);
                        obj.Add(objplstudetail);
                    }

                    getdata = null;
                }
                else
                {
                    lblSms.Text          = "No Matching Record Found.";
                    Session["dtSession"] = null;
                }
            }
            response = null; uri = null;
            return;
        }
        catch
        {
        }
        finally { }
    }