Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    #region Declaretion
                    SchoolBL  objSchoolBl = new SchoolBL();
                    DataTable dtSchool    = new DataTable();
                    #endregion
                    ApplicationResult objResultsEdit = new ApplicationResult();
                    objResultsEdit = objSchoolBl.School_Select(Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));

                    if (objResultsEdit != null)
                    {
                        dtSchool = objResultsEdit.resultDT;
                        if (dtSchool.Rows.Count > 0)
                        {
                            lblSchoolName.Text = dtSchool.Rows[0][SchoolBO.SCHOOL_SCHOOLNAMEENG].ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("Error", ex);
                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
                }
            }
        }
Exemple #2
0
        public void FetchImage()
        {
            try
            {
                #region Declaretion
                SchoolBL  objSchoolBl = new SchoolBL();
                DataTable dtSchool    = new DataTable();
                #endregion
                ApplicationResult objResultsEdit = new ApplicationResult();
                objResultsEdit = objSchoolBl.School_Select(Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));

                if (objResultsEdit != null)
                {
                    dtSchool = objResultsEdit.resultDT;
                    if (dtSchool.Rows.Count > 0)
                    {
                        ViewState["Bytes"] = dtSchool.Rows[0][SchoolBO.SCHOOL_SCHOOLLOGO];
                        if (ViewState["Bytes"].ToString() != "")
                        {
                            imgphoto.ImageUrl = "../Client.UI/GetImage.ashx?SchoolMID=" + Convert.ToInt32(Session[ApplicationSession.SCHOOLID]);
                        }
                        ViewState["Bytes"] = null;
                    }
                }
            }
            catch (Exception ex)
            {
                //DisplayErrorMsg("CommonError", ex);
            }
        }
        public void BindAcademicYear()
        {
            try
            {
                #region Fetch Academic Month from School
                SchoolBL          objSchoolBl = new SchoolBL();
                ApplicationResult objResults  = new ApplicationResult();
                int intMonth = 0;

                objResults = objSchoolBl.School_Select(Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));

                if (objResults != null)
                {
                    if (objResults.resultDT.Rows.Count > 0)
                    {
                        intMonth = Convert.ToInt32(objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ACADEMICMONTH].ToString());
                    }
                }
                #endregion

                Controls objControls  = new Controls();
                int      month        = System.DateTime.Now.Month;
                int      Year         = System.DateTime.Now.Year;
                int      lastTwoDigit = Year % 100;
                string   yr           = string.Empty;
                if (month >= intMonth)
                {
                    yr = (lastTwoDigit.ToString() + (lastTwoDigit + 1).ToString()).ToString();
                }
                else
                {
                    yr = ((lastTwoDigit - 1).ToString() + lastTwoDigit.ToString()).ToString();
                }

                int f = (Convert.ToInt32(yr.Substring(0, 2)));
                int l = (Convert.ToInt32(yr.Substring(2, 2)));

                DataTable dt = new DataTable();
                DataRow   dr = null;
                dt.Columns.Add(new DataColumn("AcademicYear", typeof(string)));

                for (int i = 0; i < 5; i++)
                {
                    dr = dt.NewRow();
                    if (i == 0)
                    {
                        dr["AcademicYear"] = Convert.ToString(f.ToString() + "-" + l.ToString());
                        dt.Rows.Add(dr);
                    }
                    else
                    {
                        if ((f - 1).ToString().Length < 2)
                        {
                            if (f.ToString().Length == 2)
                            {
                                dr["AcademicYear"] = Convert.ToString("0" + (f - 1).ToString() + "-" + (f).ToString());
                            }
                            else
                            {
                                dr["AcademicYear"] = Convert.ToString("0" + (f - 1).ToString() + "-" + "0" + (f).ToString());
                            }
                            dt.Rows.Add(dr);
                        }
                        else
                        {
                            dr["AcademicYear"] = Convert.ToString((f - 1).ToString() + "-" + (f).ToString());
                            dt.Rows.Add(dr);
                        }
                        f = f - 1;
                        l = f;
                    }
                }

                objControls.BindDropDown_ListBox(dt, ddlAcademicYear, "AcademicYear", "AcademicYear");
            }
            catch (Exception ex)
            {
                //logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
        protected void ddlSchoolName_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                ApplicationResult objResult    = new ApplicationResult();
                Controls          objControls  = new Controls();
                SectionBL         objSectionBl = new SectionBL();

                objResult = objSectionBl.Section_SelectAll_ForDropDown(Convert.ToInt32(ddlSchoolName.SelectedValue));
                if (objResult != null)
                {
                    objControls.BindDropDown_ListBox(objResult.resultDT, ddlSection, "SectionName", "SectionMID");
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                    }
                    ddlSection.Items.Insert(0, new ListItem("--Select--", ""));
                }

                #region Fetch Academic Month from School
                SchoolBL          objSchoolBl = new SchoolBL();
                ApplicationResult objResults  = new ApplicationResult();
                int intMonth = 0;

                objResults = objSchoolBl.School_Select(Convert.ToInt32(ddlSchoolName.SelectedValue));

                if (objResults != null)
                {
                    if (objResults.resultDT.Rows.Count > 0)
                    {
                        intMonth = Convert.ToInt32(objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ACADEMICMONTH].ToString());
                    }
                }
                #endregion


                int    month        = System.DateTime.Now.Month;
                int    Year         = System.DateTime.Now.Year;
                int    lastTwoDigit = Year % 100;
                string yr           = string.Empty;
                if (month >= intMonth)
                {
                    yr = (lastTwoDigit.ToString() + (lastTwoDigit + 1).ToString()).ToString();
                }
                else
                {
                    yr = ((lastTwoDigit - 1).ToString() + lastTwoDigit.ToString()).ToString();
                }

                int f = (Convert.ToInt32(yr.Substring(0, 2)));
                int l = (Convert.ToInt32(yr.Substring(2, 2)));

                DataTable dt = new DataTable();
                DataRow   dr = null;
                dt.Columns.Add(new DataColumn("AcademicYear", typeof(string)));

                for (int i = 0; i < 5; i++)
                {
                    dr = dt.NewRow();
                    if (i == 0)
                    {
                        dr["AcademicYear"] = Convert.ToString(f.ToString() + "-" + l.ToString());
                        dt.Rows.Add(dr);
                    }
                    else
                    {
                        if ((f - 1).ToString().Length < 2)
                        {
                            if (f.ToString().Length == 2)
                            {
                                dr["AcademicYear"] = Convert.ToString("0" + (f - 1).ToString() + "-" + (f).ToString());
                            }
                            else
                            {
                                dr["AcademicYear"] = Convert.ToString("0" + (f - 1).ToString() + "-" + "0" + (f).ToString());
                            }
                            dt.Rows.Add(dr);
                        }
                        else
                        {
                            dr["AcademicYear"] = Convert.ToString((f - 1).ToString() + "-" + (f).ToString());
                            dt.Rows.Add(dr);
                        }
                        f = f - 1;
                        l = f;
                    }
                }

                objControls.BindDropDown_ListBox(dt, ddlYear, "AcademicYear", "AcademicYear");
                ddlYear.Items.Insert(0, new ListItem("-Select-", "-1"));
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void gvSchool_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                SchoolBO          objSchoolBo = new SchoolBO();
                SchoolBL          objSchoolBl = new SchoolBL();
                TrustBL           objTrustBl  = new TrustBL();
                ApplicationResult objResults  = new ApplicationResult();
                BankAssociationBL objBankBl   = new BankAssociationBL();
                Controls          objControls = new Controls();

                ViewState["SchoolMID"] = Convert.ToInt32(e.CommandArgument.ToString());

                objResults = objTrustBl.Abbreviation_Validation(0, Convert.ToInt32(ViewState["SchoolMID"].ToString()), 0);

                if (objResults != null)
                {
                    if (objResults.resultDT.Rows.Count > 0)
                    {
                        txtAbbreviation.Enabled = false;
                    }
                    else
                    {
                        txtAbbreviation.Enabled = true;
                    }
                }
                objSchoolBo.TrustMID = Convert.ToInt32(Session[ApplicationSession.TRUSTID]);
                if (e.CommandName.ToString() == "Edit1")
                {
                    // txtAccStartDate.Enabled = false;
                    objResults = objSchoolBl.School_Select(Convert.ToInt32(ViewState["SchoolMID"].ToString()));

                    if (objResults != null)
                    {
                        if (objResults.resultDT.Rows.Count > 0)
                        {
                            txtSchoolName.Text             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLNAMEENG].ToString();
                            txtSchoolNameGuj.Text          = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLNAMEGUJ].ToString();
                            txtSchoolTiming.Text           = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLTIMING].ToString();
                            ddlAcademicMonth.SelectedValue = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ACADEMICMONTH].ToString();
                            txtSchoolCode.Text             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLCODE].ToString();
                            ViewState["Bytes"]             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLLOGO];
                            if (ViewState["Bytes"].ToString() != "")
                            {
                                imgphoto.ImageUrl = "GetImage.ashx?SchoolMID=" + ViewState["SchoolMID"];
                            }
                            else
                            {
                                imgphoto.ImageUrl = "~/images/noimage-big.jpg";
                                //lbtnRemovePhoto.Visible = false;
                            }
                            txtAbbreviation.Text     = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLABBREVIATION].ToString();
                            txtAccStartDate.Text     = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ACCOUNTSTARTDATE].ToString();
                            txtSchoolAddress.Text    = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ADDRESSENG].ToString();
                            txtSchoolAddressGuj.Text = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ADDRESSGUJ].ToString();
                            if (objResults.resultDT.Rows[0][SchoolBO.SCHOOL_AREATYPE].ToString() == "")
                            {
                                //rblAreaType.SelectedItem.Text = "";
                            }
                            else
                            {
                                rblAreaType.SelectedValue = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_AREATYPE].ToString();
                            }
                            if (objResults.resultDT.Rows[0][SchoolBO.SCHOOL_AREASUBTYPE].ToString() == "")
                            {
                                //rblAreaSubType.SelectedItem.Text = "";
                            }
                            else
                            {
                                rblAreaSubType.SelectedValue = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_AREASUBTYPE].ToString();
                            }

                            txtTown.Text                = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_TOWNENG].ToString();
                            txtTownGuj.Text             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_TOWNGUJ].ToString();
                            txtATPOEng.Text             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ATPONOENG].ToString();
                            txtATPOGuj.Text             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ATPONOGUJ].ToString();
                            txtTalukaEng.Text           = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_TALUKAENG].ToString();
                            txttalukaGuj.Text           = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_TALUKAGUJ].ToString();
                            txtDistrict.Text            = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_DISTRICTENG].ToString();
                            txtDistrictGuj.Text         = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_DISTRICTGUJ].ToString();
                            txtState.Text               = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_STATEENG].ToString();
                            txtStateGuj.Text            = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_STATEGUJ].ToString();
                            txtCountry.Text             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_COUNTRYENG].ToString();
                            txtCountryGuj.Text          = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_COUNTRYGUJ].ToString();
                            txtPinCode.Text             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_PINCODE].ToString();
                            txtTelephoneNo.Text         = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_TELEPHONENO].ToString();
                            txtMobileNo.Text            = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_MOBILENO].ToString();
                            txtEmailID.Text             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_EMAILID].ToString();
                            txtAlternateEmail.Text      = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ALTERNATEEMAILID].ToString();
                            txtFax.Text                 = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_FAXNO].ToString();
                            txtWebsite.Text             = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_WEBSITE].ToString();
                            txtSSCIndexNo.Text          = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SSCINDEXNO].ToString();
                            txtCommerceIndexNo.Text     = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_HSCCOMMERCEINDEXNO].ToString();
                            txtScienceIndexNo.Text      = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_HSCSCIENCEINDEXNO].ToString();
                            txtArtsIndexNo.Text         = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_HSCARTSINDEXNO].ToString();
                            txtRegistrationCode.Text    = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_REGISTRATIONCODE].ToString();
                            txtRegistrationName.Text    = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_REGISTEREDNAMEENG].ToString();
                            txtRegistrationCodeGuj.Text = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_REGISTREREDNAMEGUJ].ToString();
                            // txtRegisteredAddress.Text = dtSchool.Rows[0][SchoolBO.SCHOOL_REGISTEREDADDRESSENG].ToString();
                            txtRegisteredddressGuj.Text = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_REGISTEREDADDRESSGUJ].ToString();
                            txtSchoolMotto.Text         = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLMOTTOENG].ToString();
                            txtSchoolMottoGuj.Text      = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLMOTTOGUJ].ToString();
                            txtSchoolVision.Text        = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLVISIONENG].ToString();
                            txtSchoolVisionGuj.Text     = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_SCHOOLVISIONGUJ].ToString();
                            if (Convert.ToInt32(objResults.resultDT.Rows[0][SchoolBO.SCHOOL_ISONRENT].ToString()) == 1)
                            {
                                chkIsRent.Checked = true;
                            }
                            else
                            {
                                chkIsRent.Checked = false;
                            }
                            txtOwnerName.Text        = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_OWNERNAMEENG].ToString();
                            txtOwnerNameGuj.Text     = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_OWNERNAMEGUJ].ToString();
                            txtOwnerAddress.Text     = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_OWNERADDRESSENG].ToString();
                            txtOwnerAddressGuj.Text  = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_OWNERADDRESSGUJ].ToString();
                            txtWordNo.Text           = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_WORDNO].ToString();
                            txtWordName.Text         = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_WORDNAMEENG].ToString();
                            txtWardNameGuj.Text      = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_WORDNAMEGUJ].ToString();
                            txtPlotNo.Text           = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_PLOTNO].ToString();
                            txtPlotArea.Text         = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_PLOTAREA].ToString();
                            ddlConstructionYear.Text = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_CONSTRUNCTIONYEAR].ToString();
                            txtNoOfFloor.Text        = objResults.resultDT.Rows[0][SchoolBO.SCHOOL_NOOFFLOORS].ToString();

                            ApplicationResult objResultsBankEdit = new ApplicationResult();
                            DataTable         dtBankAssociation  = new DataTable();
                            objResultsBankEdit = objBankBl.BankAssociation_Select_TrustMID(0, Convert.ToInt32(ViewState["SchoolMID"].ToString()));
                            if (objResultsBankEdit != null)
                            {
                                dtBankAssociation = objResultsBankEdit.resultDT;
                                if (dtBankAssociation.Rows.Count > 0)
                                {
                                    gvbankAssociation.Visible = true;

                                    gvbankAssociation.DataSource = dtBankAssociation;
                                    gvbankAssociation.DataBind();
                                }
                                ViewState["dtBank"] = dtBankAssociation;
                            }
                            ViewState["Mode"] = "Edit1";
                            PanelGrid_VisibilityMode(2);
                        }
                    }
                }
                else if ((e.CommandName.ToString() == "Delete1"))
                {
                    objControls.EnableControls(Master.FindControl("ContentPlaceHolder1"));

                    objResults = objSchoolBl.Validate_School_Delete(Convert.ToInt32(ViewState["SchoolMID"].ToString()));
                    if (objResults != null)
                    {
                        if (objResults.resultDT.Rows.Count > 0)
                        {
                            if (Convert.ToInt32(objResults.resultDT.Rows[1]["SchoolMID"]) == Convert.ToInt32(ViewState["SchoolMID"].ToString()))
                            {
                                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('There are Section(s)/Student(s) associated with this School. To delete this School you need to delete Section(s)/Student(s) first.');</script>");
                                goto Exit;
                            }
                        }
                    }
                    ApplicationResult objResultsDelete     = new ApplicationResult();
                    ApplicationResult objResultsBankDelete = new ApplicationResult();
                    objResultsDelete = objSchoolBl.School_Delete(Convert.ToInt32(e.CommandArgument.ToString()));
                    if (objResultsDelete.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        ClearAll();
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('School deleted successfully.');</script>");
                        GridDataBind();
                    }
                }

                Exit :;
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
Exemple #6
0
        public void ProcessRequest(HttpContext context)
        {
            DataTable         dtResult      = new DataTable();
            SchoolBL          objSchoolBL   = new SchoolBL();
            StudentBL         objStudentBL  = new StudentBL();
            EmployeeMBL       objEmployeeBL = new EmployeeMBL();
            TrustBL           objTrustBL    = new TrustBL();
            ApplicationResult objResult     = new ApplicationResult();
            Controls          objControl    = new Controls();

            byte[] imgByte = { };
            if (context.Request.QueryString["StudentMID"] != null)
            {
                objResult = objStudentBL.Student_Select(Convert.ToInt32(context.Request.QueryString["StudentMID"].ToString()), 0);
                if (objResult != null)
                {
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                        imgByte = (byte[])objResult.resultDT.Rows[0]["StudentPhoto"];
                    }
                }
            }
            else if (context.Request.QueryString["SchoolMID"] != null)
            {
                objResult = objSchoolBL.School_Select(Convert.ToInt32(context.Request.QueryString["SchoolMID"].ToString()));
                if (objResult != null)
                {
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                        imgByte = (byte[])objResult.resultDT.Rows[0]["SchoolLogo"];
                    }
                }
            }
            else if (context.Request.QueryString["EmployeeMID"] != null)
            {
                objResult = objEmployeeBL.EmployeeM_Select(Convert.ToInt32(context.Request.QueryString["EmployeeMID"].ToString()));
                if (objResult != null)
                {
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                        imgByte = (byte[])objResult.resultDT.Rows[0]["Photo"];
                    }
                }
            }
            else
            {
                objResult = objTrustBL.Trust_Select(Convert.ToInt32(context.Request.QueryString["TrustMID"].ToString()));
                if (objResult != null)
                {
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                        imgByte = (byte[])objResult.resultDT.Rows[0]["TrustLogo"];
                    }
                }
            }

            // objResult = objVisitorBL.Visitor_Select(1);


            context.Response.BinaryWrite(imgByte);
            context.Response.End();
            context.Response.Clear();
            context.Response.ClearHeaders();
            context.Response.ClearContent();
        }