Пример #1
0
        //Save Data
        #region SaveData

        protected void btnSave_Click(object sender, EventArgs e)
        {
            BL_FeesCategory  objBL  = new BL_FeesCategory();
            EWA_FeesCategory objEWA = new EWA_FeesCategory();

            try
            {
                lock (this)
                {
                    if (txtFeesCategoryName.Text == "")
                    {
                        msgBox.ShowMessage("Please Enter Fees Category Name !!!", "Information", UserControls.MessageBox.MessageStyle.Information);
                    }

                    else
                    {
                        //ViewState["DocumentId"] = 0;
                        int chk = CheckData();
                        if (chk > 0)
                        {
                            msgBox.ShowMessage("Record Allready Exist !!!", "Information", UserControls.MessageBox.MessageStyle.Information);
                        }
                        else
                        {
                            Action("Save");
                            GrdFeesCategoryBind();
                            LoadForm();
                        }
                    }
                }
            }
            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;
                    }
                }
            }
        }