Beispiel #1
0
    protected void btnReset_Click(object sender, EventArgs e)
    {
        string strResult = "";

        string[] strUID;
        string   StrStudentID = "";

        ((MSCaptcha.CaptchaControl)btnReset.FindControl("ccJoin")).ValidateCaptcha(((TextBox)btnReset.FindControl("txtCapText")).Text);
        if (!((MSCaptcha.CaptchaControl)btnReset.FindControl("ccJoin")).UserValidated)
        {
            lblCode.Text    = "Code Mismatch. Please enter the Code again.";
            txtCapText.Text = "";
            txtCapText.Focus();
            return;
        }
        else
        {
            lblCode.Text = "";
        }

        if (rbtnReg.Checked == true)
        {
            StrStudentID = objCCWeb.ReturnSingleValue("Select SM.Applicationid from AdmStudentMaster SM Inner Join ADMFatherDetails FD on SM.ApplicationID=FD.ApplicationID where SM.FirstName='" + txtFirstName.Text.Trim().Replace("'", "''") + "' and SM.DOB='" + objCCWeb.ChangeYYYYMMDD(txtDOB.Text.Trim()) + "' and SM.MobileNo='" + txtMobileNo.Text.Trim().Replace("'", "''") + "' ");

            if (StrStudentID != "")
            {
                strUID = objCCWeb.ReturnSingleValue("SELECT CAST(UID AS VARCHAR)+'^'+CAST(UserID aS VARCHAR) From MTUserMaster where EmployeeIDStudentID=" + StrStudentID + " AND UsertypeID=6 and UserStatus='Y'").ToString().Split('^');
                if (strUID[0] != "")
                {
                    string strPassword = getCode();
                    if (strResult == "")
                    {
                        strResult = objCCWeb.ExecuteQuery("UPDATE MTUserMaster SET UserPassword='******' WHERE UID=" + strUID[0] + " and UserTypeID=6  and UserStatus='Y' and  UserID  like 'SR%'");
                        strResult = strResult + objCCWeb.ExecuteQuery("Update AdmStudentMaster Set StrNum='" + strPassword + "' where ApplicationId=" + StrStudentID + "");
                        if (strResult == "")
                        {
                            sendSMS("91" + txtMobileNo.Text.Trim().Replace("'", "''") + "", "Your UserID is " + strUID[1] + " and your password is " + strPassword + ". Please retain this information for future reference.", strUID[0]);
                            txtMobileNo.Text  = "";
                            txtDOB.Text       = "";
                            txtFirstName.Text = "";
                            txtCapText.Text   = "";
                            strResult         = "The New Password Has Been Sent To The Registered Mobile No.";
                        }
                    }
                }
                else
                {
                    strResult = "User ID Does not Exist For This Child.";
                }
            }
            else
            {
                strResult = "UserID Does not Exist For This Child.";
            }
        }
        if (rbtnParentlogin.Checked == true)
        {
            StrStudentID = objCCWeb.ReturnSingleValue("Select ParentID from SIStudentMaster SM Inner join SIStudentFatherDetails  FD on FD.StudentID=SM.StudentID where SM.FirstName='" + txtFirstName.Text.Trim().Replace("'", "''") + "' and SM.DateofBirth='" + objCCWeb.ChangeYYYYMMDD(txtDOB.Text.Trim()) + "' and FD.MobileNo like '%" + txtMobileNo.Text.Trim().Replace("'", "''") + "%' ");
            if (StrStudentID != "")
            {
                strUID = objCCWeb.ReturnSingleValue("SELECT CAST(UID AS VARCHAR)+'^'+CAST(UserID aS VARCHAR) From MTUserMaster where EmployeeIDStudentID=" + StrStudentID + " AND UsertypeID=3 and UserID like 'P%'").ToString().Split('^');
                if (strUID[0] != "")
                {
                    string strPassword = getCode();
                    if (strResult == "")
                    {
                        strResult = objCCWeb.ExecuteQuery("UPDATE MTUserMaster SET UserPassword='******' WHERE UID=" + strUID[0] + " and UserTypeID=3 and UserID like 'P%'");
                        if (strResult == "")
                        {
                            sendSMS("91" + txtMobileNo.Text.Trim().Replace("'", "''") + "", "Your UserID is " + strUID[1] + " and your password is " + strPassword + ". Please retain this details for future reference.", strUID[0]);
                            txtMobileNo.Text  = "";
                            txtDOB.Text       = "";
                            txtFirstName.Text = "";
                            strResult         = "The New Password Has Been Sent To The Registered Mobile No.";
                        }
                    }
                }
                else
                {
                    strResult = "Parent User ID Does not Exist For This Child.";
                }
            }
            else
            {
                strResult = "Entered data is not matching with our data";
            }
        }

        if (rbtnStudentlogin.Checked == true)
        {
            StrStudentID = objCCWeb.ReturnSingleValue("Select SM.StudentID from SIStudentMaster SM Inner join SIStudentFatherDetails FD on FD.StudentID=SM.StudentID where SM.FirstName='" + txtFirstName.Text.Trim().Replace("'", "''") + "' and SM.DateofBirth='" + objCCWeb.ChangeYYYYMMDD(txtDOB.Text.Trim()) + "' and FD.MobileNo like '%" + txtMobileNo.Text.Trim().Replace("'", "''") + "%' ");
            if (StrStudentID != "")
            {
                strUID = objCCWeb.ReturnSingleValue("SELECT CAST(UID AS VARCHAR)+'^'+CAST(UserID aS VARCHAR) From MTUserMaster where EmployeeIDStudentID=" + StrStudentID + " AND UsertypeID=2 and UserID like 'S%'").ToString().Split('^');
                if (strUID[0] != "")
                {
                    string strPassword = getCode();
                    if (strResult == "")
                    {
                        strResult = objCCWeb.ExecuteQuery("UPDATE MTUserMaster SET UserPassword='******' WHERE UID=" + strUID[0] + " and UserTypeID=2 and UserID like 'S%'");
                        if (strResult == "")
                        {
                            sendSMS("91" + txtMobileNo.Text.Trim().Replace("'", "''") + "", "Your UserID is " + strUID[1] + " and your password is " + strPassword + ". Please retain this details for future reference.", strUID[0]);
                            txtMobileNo.Text  = "";
                            txtDOB.Text       = "";
                            txtFirstName.Text = "";
                            txtCapText.Text   = "";
                            strResult         = "The New Password Has Been Sent To The Registered Mobile No.";
                        }
                    }
                }
                else
                {
                    strResult = "Student User ID Does not Exist For This Child.";
                }
            }
            else
            {
                strResult = "Entered data is not matching with our data";
            }
        }

        ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script>alert('" + strResult + "');</script>");
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
        Response.Cache.SetNoStore();
        Response.AddHeader("Cache-control", "no-store,must-revalidate,private,no-cache,no-store,pre-check=0,post-check=0,max-stale=0");
        Response.AddHeader("Pragma", "no-cache");
        Response.AddHeader("Expires", "0");

        if (Session["UID"] == null || Session["SchoolID"] == null)
        {
            Response.Write("<script>window.close();window.open('Logon.aspx','_Parent');</script>");
            return;
        }
        if ((objCCWeb.ReturnNumericValue("SELECT Count(*) FROM MTUserLimitMaster WHERE UID=" + Session["UID"] + " AND ModuleID=26 AND MenuName='mnuEventAssigner'") == 0) || (objCCWeb.ReturnSingleValue("SELECT ISNULL(VisibleOption,'N') FROM MTUserLimitMaster WHERE UID=" + Session["UID"] + " AND ModuleID=26 AND MenuName='mnuEventAssigner'") == "N"))
        {
            Session.Clear();
            Response.Redirect("Logon.aspx");
            return;
        }
        if (objCCWeb.pCheckText(form1) == true)
        {
            Response.Write("<script>window.close();window.open('Logon.aspx','_parent');</script>");
            return;
        }
        if (Request.QueryString["StrQuery"] != null)
        {
            string strResult = "";
            string strQuery  = "";
            if (Request.QueryString["StrQuery"] == "Event")
            {
                strQuery = " EXEC spEvent '" + objCCWeb.ChangeYYYYMMDD(Request.QueryString["Value"].ToString()) + "'";
            }
            SqlDataReader sqlRdr = objCCWeb.BindReader(strQuery);
            while (sqlRdr.Read())
            {
                for (int intForLoop = 0; intForLoop < sqlRdr.FieldCount; intForLoop++)
                {
                    strResult = strResult + sqlRdr.GetValue(intForLoop).ToString() + "^";
                }
                if (strResult != "")
                {
                    strResult = strResult.Remove(strResult.Length - 1);
                }
                strResult = strResult + "~";
            }

            if (strResult != "")
            {
                strResult = strResult.Remove(strResult.Length - 1);
            }
            sqlRdr.Close();
            sqlRdr.Dispose();
            Response.Clear();
            Response.ContentType = "text/xml";
            Response.Write(strResult);
            Response.End();
        }
        if (Request.QueryString["ControlID"] != null)
        {
            string strResult  = "";
            string strQuery   = "";
            string strControl = Request.QueryString["ControlID"].ToString();
            if (strControl == "chkClassSection")
            {
                strQuery = "SELECT ClassID,ClassName,EventClassID From(select DISTINCT CM.PriorityNo, CAST(CM.ClassID AS NVARCHAR)+'^'+CAST(SM.SectionID AS NVARCHAR) AS ClassID,CM.ClassName1+'-'+SM.SectionName1 AS ClassName,ISNULL(CAST(ECD.ClassID AS NVARCHAR)+'^'+CAST(ECD.SectionID AS NVARCHAR),'') AS EventClassID " +
                           " FROM SISTudentYearWiseDetails SYD  " +
                           " INNER JOIN MTClassMaster CM On SYD.ClassID= CM.ClassID  " +
                           " INNER JOIN MTSectionMAster SM ON SYD.SectionID= SM.SectionID  " +
                           " LEFT JOIN EventClassDetail ECD ON ECD.classID=SYD.ClassID AND ECD.SectionID=SYD.SectionID " +
                           " AND ECD.EventID IN(SELECT Top 1 EventID From EventMaster Where EventDate='" + objCCWeb.ChangeYYYYMMDD(Request["Value"].ToString()) + "') " +
                           " WHERE SYD.SchoolID=" + Session["SchoolID"] + " AND SYD.AcaStart=" + Session["AcaStart"] + " AND  CM.PriorityNo<>0)SUB  ORDER BY PriorityNo";
            }

            SqlDataReader rdrVal = objCCWeb.BindReader(strQuery);
            while (rdrVal.Read())
            {
                strResult = strResult + rdrVal.GetValue(0).ToString() + "," + rdrVal.GetValue(1).ToString() + "," + rdrVal.GetValue(2).ToString() + "~";
            }
            if (strResult != "")
            {
                strResult = strResult.Remove(strResult.Length - 1);
            }

            rdrVal.Close();
            Response.Clear();
            Response.ContentType = "text/xml";
            Response.Write(strResult);
            Response.End();
        }
        if (Request.QueryString["Flag"] != null)
        {
            string strQuery = "";
            if (Request.QueryString["Flag"] == "Report")
            {
                strQuery = "DECLARE @Var nvarchar(200) SET @Var=''  " +
                           " Select  @Var=@Var+  Class+',' From ( SELECT Distinct CAST(ECD.ClassID AS NVARCHAR)+'^'+CAST(ECD.SectionID AS NVARCHAR) AS Class " +
                           " FROM SISTudentYearWiseDetails SYD  " +
                           " INNER JOIN EventClassDetail ECD ON ECD.classID=SYD.ClassID AND ECD.SectionID=SYD.SectionID " +
                           " AND ECD.EventID IN(SELECT Top 1 EventID From EventMaster " +
                           " Where EventDate='" + objCCWeb.ChangeYYYYMMDD(Request.QueryString["Value"].ToString()) + "'))SUB " +
                           " SELECT CASE WHEN LEN(@Var )>1  THEN SUBSTRING(@Var,1,LEN(@Var)-1) ELSE '' END";
            }

            string strResult = objCCWeb.ReturnSingleValue(strQuery);
            Response.Clear();
            Response.ContentType = "text/xml";
            Response.Write(strResult);
            Response.End();
        }
        if (!IsPostBack)
        {
            hidCache.Value = "";
            gvEventDetails.Attributes.Add("bordercolor", "#FFC1A4");
            btnSelectAll.Attributes.Add("onclick", "javascript:return fClassSubject(1);");
            btnDeSelect.Attributes.Add("onclick", "javascript:return fClassSubject(0);");
            chkClassSection.Attributes.Add("oncontextmenu", "javascript:return fSelectDeSelect(event)");
            btnDoubleClick_Click(sender, e);
            ClientScript.RegisterStartupScript(this.GetType(), "dis", "<script language=javascript>fBindCheckBoxList('chkClassSection','" + DateTime.Now.ToString("dd/MM/yyyy") + "');</script>");
            //fBindCheckBoxList('chkClassSection',varDate);
        }
        pGetOption();
    }