示例#1
0
        //Fees Category
        #region [Fees Category Grid Bind]

        private void GrdFeesCategoryBind()
        {
            try
            {
                // objEWA.OrgId = Convert.ToInt32(orgId.ToString());
                objEWA.OrgId = Convert.ToInt32(Session["OrgId"]);
                DataSet ds = objBL.FeesCategoryGridBind_BL(objEWA);
                if (ds.Tables[0].Rows.Count == 0 || ds == null)
                {
                    ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
                    GrdFeesCategory.DataSource = ds;
                    GrdFeesCategory.DataBind();
                    int columncount = GrdFeesCategory.Rows[0].Cells.Count;
                    GrdFeesCategory.Rows[0].Cells.Clear();
                    GrdFeesCategory.Rows[0].Cells.Add(new TableCell());
                    GrdFeesCategory.Rows[0].Cells[0].ColumnSpan = columncount;
                    GrdFeesCategory.Rows[0].Cells[0].Text       = "No Records Found";
                }
                else
                {
                    GrdFeesCategory.DataSource = ds;
                    GrdFeesCategory.DataBind();
                }
            }

            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            orgId = Convert.ToInt32(Session["OrgId"]);
            if (orgId == 0)
            {
                Response.Redirect("~/CMSHome.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    //if (Session["OrgId"] == null)
                    //{
                    //    Response.Redirect("/CMSHome.aspx");
                    //}
                    objEWA.OrgId = Session["OrgId"].ToString();

                    txtBirthDate.Attributes.Add("ReadOnly", "True");
                    //ds = new DataSet();
                    //ds.ReadXml(Server.MapPath("AddressXMLFile.xml"));
                    //ViewState["DatasetAll"] = ds;
                    //LoadCountryDropDown();
                    //LoadSportDropDown();
                    LoadCasteCategoryDropDown();
                    Bind_ddlCountry();
                    Bind_ddlState1();


                    BL_FeesCategory  objBL   = new BL_FeesCategory();
                    EWA_FeesCategory objEWA1 = new EWA_FeesCategory();
                    objEWA1.OrgId = Convert.ToInt32(Session["OrgId"]);
                    DataSet ds = objBL.FeesCategoryGridBind_BL(objEWA1);
                    ddlFeesCategory.DataSource     = ds;
                    ddlFeesCategory.DataTextField  = "FeesCategoryName";
                    ddlFeesCategory.DataValueField = "FeesCategoryId";
                    ddlFeesCategory.DataBind();
                    ddlFeesCategory.Items.Insert(0, "Select");


                    ShowStudentProfile(objEWA);

                    SqlCommand     cmd1 = new SqlCommand("select Photo from tblStudent where OrgId='" + Session["OrgId"].ToString() + "' and UserCode='" + Session["UserCode"].ToString() + "'", cn);
                    SqlDataAdapter adp1 = new SqlDataAdapter();
                    DataSet        ds1  = new DataSet();
                    adp1.SelectCommand = cmd1;
                    adp1.Fill(ds1);
                    //lblTrustName.Text = ds1.Tables[0].Rows[0]["OrgName"].ToString();

                    string Photo = ds1.Tables[0].Rows[0]["Photo"].ToString();// db.getDbstatus_Value("select Photo from tblStudent where OrgId='" + Session["OrgId"].ToString() + "' and UserCode='" + Session["UserCode"].ToString() + "'");



                    if (Photo != "0" && Photo != "")
                    {
                        Byte[] bytes = (Byte[])ds1.Tables[0].Rows[0]["Photo"];

                        string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
                        img_StudentImage.ImageUrl = "data:image/png;base64," + base64String;
                        ViewState["StudentPhoto"] = bytes;
                    }
                }
            }
        }