Esempio n. 1
0
 protected void LinkButton1_Click(object sender, EventArgs e)
 {
     if (Session["Cache"] != null)
     {
         Cache.Remove(Session["Cache"].ToString());
     }
     objCCWeb.ExecuteQuery("UPDATE MDUserLoginDetails SET LoggedOutTime=GETDATE() WHERE  LoggedOutTime IS NULL AND  SessionDetails='" + Session["UserLogin"] + "'");
     Session.Clear();
     Response.Redirect("Logon.aspx");
 }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        try
        {
            string   strResult;
            string[] strArray = hidFlag.Value.ToString().Split('^');
            if (objCCWeb.ReturnNumericValue("EXEC spGetPrimaryValueExists 'SchoolID','MTClientCompany','" + Convert.ToInt32(gvInstitute.Rows[Convert.ToInt32(strArray[2])].Cells[1].Text) + "'") > 0)
            {
                //ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('School Is In Use')</script>");
                strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "4", "");
                ClientScript.RegisterStartupScript(this.GetType(), "dispScript", "<script language='javascript'>" + strHideID + "alert('" + strResult + "')</script>");
                return;
            }
            else
            {
                strResult = objCCWeb.ExecuteQuery("INSERT INTO UserUpdateDetails(UID,SessionID,UpdateDate,FormName,Details) VALUES(" + Session["UID"] + ",'" + Session.SessionID + "',GETDATE(),'mnuInstitutionMaster','School " + (txtInstitution1.Text.Trim().Replace("'", "''") != "" ? txtInstitution1.Text.Trim().Replace("'", "''") : txtInstitution2.Text.Trim().Replace("'", "''")) + " Information ,Is Deleted')");

                strResult = objCCWeb.ExecuteQuery("DELETE FROM MTClientCompany WHERE SchoolID=" + Convert.ToInt32(gvInstitute.Rows[Convert.ToInt32(strArray[2])].Cells[1].Text) + "");
                if (strResult == "")
                {
                    //ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>" + strHideID + "alert('Deleted Successfully')</script>");
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "3", "");
                    ClientScript.RegisterStartupScript(this.GetType(), "displayDelete", "<script language=javascript>" + strHideID + "alert('" + strResult + "')</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>" + strHideID + "alert('" + strResult + "')</script>");
                }
            }
            BindDDL();
            btnCancel_Click(sender, e);
        }
        catch (Exception exMyError)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('" + exMyError.Message.Replace("'", "") + "')</script>");
        }
    }
Esempio n. 3
0
    protected void lnkOnline_Click(object sender, EventArgs e)
    {
        int intAcastart = objCCWeb.ReturnNumericValue("Select MAX(AcaStart) From MTAcademicsessionmaster");

        Session["UserLogin"] = Session.SessionID;
        objCCWeb.ExecuteQuery("INSERT INTO MDUserLoginDetails(IPAddress,LoginTime,SessionDetails,UserAgent,Referrer,URL,LoggedOutTime,LoginSuccessStatus) VALUES ('" + Request.ServerVariables.Get("remote_addr").ToString() + "',GETDATE(),'" + Session.SessionID.ToString() + "','" + hidBrsr.Value.Trim().ToString() + "','" + Request.UrlReferrer.ToString() + "','" + Request.Url.ToString() + "',null,'Y')");
        ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=\"javascript\">alert('Online Registration Not Started !');</script>");
        Response.Redirect("NewGuideline.aspx");
    }
Esempio n. 4
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>");
    }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strResult = "";

        if (Request["TypeID"] != null && Request["TypeID"] != "")
        {
            //SqlDataReader sqlRdr;
            if (Request["TypeID"] == "FillListBox")
            {
                sqlRdr = objCCWeb.BindReader(Request["StrQuery"]);
                //if (Request["pAction"]=="FillListBox")
                // {
                //     sqlRdr = objCCWeb.BindReader(Request["strQuery"]);
                // }
                while (sqlRdr.Read())
                {
                    strResult = strResult + sqlRdr.GetValue(0).ToString() + "^" + sqlRdr.GetValue(1).ToString() + "~";
                }
                if (strResult != "")
                {
                    strResult = strResult.Remove(strResult.Length - 1);
                }
            }
            else if (Request["TypeID"] == "ReturnSingleValue")
            {
                sqlRdr = objCCWeb.BindReader(Request["StrQuery"]);
                //if (Request["pAction"]=="FillListBox")
                // {
                //     sqlRdr = objCCWeb.BindReader(Request["strQuery"]);
                // }
                if (sqlRdr.Read())
                {
                    strResult = sqlRdr.GetValue(0).ToString();
                }
            }
            //else if (Request["TypeID"] == "ExecuteQuery")
            //{
            //    strResult = objCCWeb.ExecuteQuery(Request["StrQuery"]);
            //}
            else if (Request["TypeID"] == "FillClientGrid")
            {
                Int32 intcount = 0;
                sqlRdr = objCCWeb.BindReader(Request["StrQuery"]);
                while (sqlRdr.Read())
                {
                    if (intcount == 0)
                    {
                        intcount = 1;
                        for (int intForLoop = 0; intForLoop < sqlRdr.FieldCount; intForLoop++)
                        {
                            strResult = strResult + sqlRdr.GetName(intForLoop).ToString() + "^";
                        }
                        if (strResult != "")
                        {
                            strResult = strResult.Remove(strResult.Length - 1);
                        }
                        strResult = strResult + "~";
                    }
                    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);
                }
            }
            else //if (Request["TypeID"] == "FillGrid")
            {
                sqlRdr = objCCWeb.BindReader(Request["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();
        }
        else if (Request["TypeID"] == "ExecuteQuery")
        {
            strResult = objCCWeb.ExecuteQuery(Request["StrQuery"]);
            Response.Clear();
            Response.ContentType = "text/xml";
            Response.Write(strResult);
            Response.End();
        }
        //}
    }
Esempio n. 6
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string   strResult;
            string   strResult1;
            string[] astrFlag = hidFlag.Value.Split('^');
            if (astrFlag[0] == "N")
            {
                astrFlag[1] = "0";
            }
            List <string> lstArray = new List <string>();

            if (astrFlag[0] == "N")
            {
                //  objCCWeb.FillCheckedBoxList(chkReportName, "SELECT 0 AS ReportID,'' AS ReportName" + Session["Type"] + " UNION SELECT ReportID,ReportName" + Session["Type"] + " FROM MTReportMaster WHERE ReportID>0 AND ModuleID="+Convert.ToInt32(ddlModuleID.SelectedValue)+"ORDER BY ReportID, ReportName" + Session["Type"] + "", "ReportID", "ReportName" + Session["Type"] + "", " ");

                if (objCCWeb.ReturnNumericValue("SELECT Count(*) FROM MTReportGroupMaster WHERE ModuleID=" + ddlModuleID.SelectedValue + "") == 5)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('Only Five Group Per Module Is Allowed To Create')</script>");
                    return;
                }
                if (objCCWeb.ReturnNumericValue("SELECT COUNT(GroupId) FROM MTReportGroupMaster WHERE UPPER(PriorityNo)='" + txtpriority.Text.Trim() + "' AND GroupId<>" + astrFlag[1] + " AND ModuleID=" + ddlModuleID.SelectedValue) > 0)
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblpriority.Text);
                    ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('" + strResult + "')</script>");
                    txtpriority.Focus();
                    return;
                }


                if (objCCWeb.ReturnNumericValue("SELECT COUNT(GroupId) FROM MTReportGroupMaster WHERE UPPER(GroupName)='" + txtReportGroupName1.Text.Trim().Replace("'", "''").ToUpper() + "' AND GroupId<>" + astrFlag[1]) > 0)
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblpriority.Text);
                    ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('" + strResult + "');</script>");
                    txtReportGroupName1.Focus();
                    return;
                }


                if (objCCWeb.ReturnNumericValue("SELECT COUNT(*) FROM MTReportGroupMaster") == 0)
                {
                    strResult = objCCWeb.ExecuteQuery("INSERT INTO MTReportGroupMaster(GroupID,GroupName,ModuleID,PriorityNo) values(0,'',0,0)");
                }
                strResult = objCCWeb.ExecuteQuery("INSERT INTO MTReportGroupMaster(GroupID,GroupName,ModuleID,PriorityNo) SELECT ISNULL(MAX(GroupID),0)+1,'" + txtReportGroupName1.Text.Trim().Replace("'", "''") + "'," + ddlModuleID.SelectedValue + "," + txtpriority.Text.Trim() + " FROM MTReportGroupMaster ");
                int GroupID = objCCWeb.ReturnNumericValue("SELECT ISNULL(MAX(GroupID),0) FROM MTReportGroupMaster");
                for (int intForLoop = 0; intForLoop < chkReportName.Items.Count; intForLoop++)
                {
                    if (chkReportName.Items[intForLoop].Selected == true)
                    {
                        string[] ReportName  = chkReportName.Items[intForLoop].Text.Split('#');
                        int      INTModuleID = objCCWeb.ReturnNumericValue("SELECT ModuleID FROM MTReportMaster where ReportName" + Session["Type"] + "='" + ReportName[0].Trim() + "'");
                        int      INTReportID = objCCWeb.ReturnNumericValue("SELECT ReportID FROM MTReportMaster where ReportName" + Session["Type"] + "='" + ReportName[0].Trim() + "'");
                        //lstArray.Add("INSERT INTO MTReportGroupMaster(ModuleID) VALUES("+  INTModuleID + ")");
                        lstArray.Add("INSERT INTO MTReportGroupDetails(GroupID,ReportID) Values(" + GroupID + "," + INTReportID + ")");
                    }
                }
                strResult1 = objCCWeb.ExecuteQueryList(lstArray);
            }
            else
            {
                if (astrFlag[0] == "E" && astrFlag[6].Trim() != txtpriority.Text.Trim())
                {
                    //int moduleid = int.Parse(ddlModuleID.SelectedValue);
                    // int i = objCCWeb.ReturnNumericValue("SELECT COUNT(GroupId) FROM MTReportGroupMaster WHERE UPPER(PriorityNo)='" + txtpriority.Text.Trim() + "' AND GroupId<>" + astrFlag[1] + " AND ModuleID=" + ddlModuleID.SelectedValue);
                    if (objCCWeb.ReturnNumericValue("SELECT COUNT(GroupId) FROM MTReportGroupMaster WHERE UPPER(PriorityNo)='" + txtpriority.Text.Trim() + "' AND GroupId<>" + astrFlag[1] + " AND ModuleID=" + astrFlag[5]) > 0)
                    {
                        strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblpriority.Text);
                        ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('" + strResult + "')</script>");
                        hidFlag.Value = "E'" + "^" + "^" + "^" + "^" + "^" + "^";
                        //string str = hidFlag.Value.Split('^');
                        //  str.Replace('E','U');
                        //  hidFlag.Value = str;
                        //string temp="U";
                        //for (int i = 0; i < str.Length; i++)
                        //{
                        //    if (str[i] == 'E')
                        //    {
                        //        temp = temp + str[i];
                        //    }
                        //}

                        //  astrFlag[0].Replace('E','U');
                        //hidFlag.Value = "";
                        txtpriority.Focus();
                        return;
                    }
                }

                if (astrFlag[0] == "E" && astrFlag[2].Trim().ToUpper() != txtReportGroupName1.Text.Trim().ToUpper())
                {
                    if (objCCWeb.ReturnNumericValue("SELECT COUNT(GroupID) FROM MTReportGroupMaster WHERE UPPER(GroupName)='" + txtReportGroupName1.Text.Trim().Replace("'", "''").ToUpper() + "' AND GroupId<>" + astrFlag[1]) > 0)
                    {
                        strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblReportGroupName1.Text);
                        ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('" + strResult + "')</script>");
                        hidFlag.Value = "E'" + "^" + "^" + "^" + "^" + "^" + "^";
                        //hidFlag.Value = "";
                        txtReportGroupName1.Focus();
                        return;
                    }
                }


                //lstArray.Add("DELETE FROM MTReportGroupMaster WHERE GroupID =" + Convert.ToInt32(astrFlag[1]) + "");
                lstArray.Add("DELETE FROM MTReportGroupDetails Where GroupID=" + Convert.ToInt32(astrFlag[1]) + "");
                strResult = objCCWeb.ExecuteQuery("UPDATE MTReportGroupMaster SET GroupName='" + txtReportGroupName1.Text.Trim().Replace("'", "''") + "',ModuleID=" + astrFlag[5] + ",PriorityNo=" + txtpriority.Text.Trim() + "WHERE GroupId=" + Convert.ToInt32(astrFlag[1]) + "");
                int GroupID = objCCWeb.ReturnNumericValue("SELECT ISNULL(MAX(GroupID),0)  FROM MTReportGroupMaster");
                for (int intForLoop = 0; intForLoop < chkReportName.Items.Count; intForLoop++)
                {
                    if (chkReportName.Items[intForLoop].Selected == true)
                    {
                        string[] ReportName = chkReportName.Items[intForLoop].Text.Split('#');

                        int INTModuleID = Convert.ToInt32(ddlModuleID.SelectedValue); //objCCWeb.ReturnNumericValue("SELECT Moduleid FROM MTUserGroupMaster where ModuleName" + Session["Type"] + "='" + ModuleID[0].Trim() + "'");
                        //int INTReportID = objCCWeb.ReturnNumericValue("SELECT ReportID FROM MTReportMaster where ReportName" + Session["Type"] + "='" + ReportName[intForLoop].Trim() + "'");
                        int INTReportID = Convert.ToInt32(chkReportName.Items[intForLoop].Value);
                        //lstArray.Add("INSERT INTO MTReportGroupMaster(GroupID,ModuleID) VALUES(" + Convert.ToInt32(astrFlag[1]) + "," + INTModuleID + ")");
                        lstArray.Add("Insert INTO MTReportGroupDetails(GroupID,ReportID) VALUES(" + Convert.ToInt32(astrFlag[1]) + "," + INTReportID + ")");
                    }
                }
                strResult1 = objCCWeb.ExecuteQueryList(lstArray);
            }
            btnCancel_Click(sender, e);
            //strResult1 = objCCWeb.ExecuteQueryList(lstArray);
            if (strResult == "")
            {
                if (astrFlag[0] == "N")
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "1", "");
                }
                else
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "2", "");
                }
                ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>" + strHideID + "alert('" + strResult + "');</script>");
                objCCWeb.FillCheckedBoxList(chkReportName, "SELECT ReportID,ReportName" + Session["Type"] + " FROM MTReportMaster WHERE ReportID>0 ORDER BY ReportID, ReportName" + Session["Type"] + "", "ReportID", "ReportName" + Session["Type"] + "", "");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>" + strHideID + "alert('" + strResult + "')</script>");
            }
            hidFlag.Value = "";
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "disError", "<script language='javascript'>" + strHideID + "alert('" + ex.Message.ToString().Replace("'", "") + "');</script>");
        }
    }
Esempio n. 7
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string[] strArray = hidFlag.Value.Split('^');
            string   strResult;
            string   strShowFlag    = "N";
            string   PayGatewayFlag = "N";
            if (chkShowParentLogin.Checked == true)
            {
                strShowFlag = "Y";
            }
            if (chkPayGatewayFlag.Checked == true)
            {
                PayGatewayFlag = "Y";
            }

            if (objCCWeb.ReturnNumericValue("SELECT COUNT(*) FROM MTAcademicSessionMaster WHERE AcaStart<" + txtAcaSession1.Text.Trim() + " AND AcaEndDate>" + objCCWeb.ReturnDateorNull(txtSessionStart.Text.Trim())) > 0)
            {
                //ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('Existing Academic Session Overlapping')</script>");
                strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "101_1", "");
                ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('" + strResult + "')</script>");
                return;
            }
            if (objCCWeb.ReturnNumericValue("SELECT COUNT(*) FROM MTAcademicSessionMaster WHERE AcaStart>" + txtAcaSession1.Text.Trim() + " AND AcaStartDate<" + objCCWeb.ReturnDateorNull(txtSessionEnd.Text.Trim())) > 0)
            {
                //ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('Existing Academic Session Overlapping')</script>");
                strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "101_1", "");
                ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('" + strResult + "')</script>");
                return;
            }
            if (strArray[0] == "N")
            {
                if (objCCWeb.ReturnNumericValue("SELECT COUNT(*) FROM MTAcademicSessionMaster WHERE AcaStart='" + txtAcaSession1.Text.Trim() + "'") > 0)
                {
                    //ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('Academic Session already Exist')</script>");
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblAcademicSession1.Text);
                    ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('" + strResult + "')</script>");
                    return;
                }

                strResult = objCCWeb.ExecuteQuery("INSERT INTO MTAcademicSessionMaster(AcaStart,AcaStartDate,AcaEndDate,EntryUserID,EntryDate,ShowFlag,PayGatewayFlag) " +
                                                  " VALUES(" + txtAcaSession1.Text.Trim() + "," + objCCWeb.ReturnDateorNull(txtSessionStart.Text.Trim()) + "," + objCCWeb.ReturnDateorNull(txtSessionEnd.Text.Trim()) + "," +
                                                  " " + Session["UID"].ToString() + ",GETDATE(),'" + strShowFlag + "','" + PayGatewayFlag + "')");
                strResult = objCCWeb.ExecuteQuery("INSERT INTO UserUpdateDetails(UID,SessionID,UpdateDate,FormName,Details) VALUES(" + Session["UID"] + ",'" + Session.SessionID + "',GETDATE(),'mnuAcademicSession','Academic Session: " + txtAcaSession1.Text.Trim() + " - " + (Convert.ToInt32(txtAcaSession1.Text.Trim()) + 1) + " ,Is Added')");
            }
            else
            {
                strResult = objCCWeb.ExecuteQuery("UPDATE MTAcademicSessionMaster SET AcaStartDate=" + objCCWeb.ReturnDateorNull(txtSessionStart.Text.Trim()) + "," +
                                                  "AcaEndDate=" + objCCWeb.ReturnDateorNull(txtSessionEnd.Text.Trim()) + ",UpdateUserID=" + Session["UID"].ToString() + ",UpdateDate=GETDATE()," +
                                                  "ShowFlag='" + strShowFlag + "',PayGatewayFlag='" + PayGatewayFlag + "' WHERE AcaStart=" + gvAcademicSession.Rows[Convert.ToInt32(strArray[1])].Cells[1].Text);
                strResult = objCCWeb.ExecuteQuery("INSERT INTO UserUpdateDetails(UID,SessionID,UpdateDate,FormName,Details) VALUES(" + Session["UID"] + ",'" + Session.SessionID + "',GETDATE(),'mnuAcademicSession','Academic Session: " + txtAcaSession1.Text.Trim() + " - " + (Convert.ToInt32(txtAcaSession1.Text.Trim()) + 1) + " ,Is Modified')");
            }
            if (strResult == "")
            {
                if (strArray[0] == "N")
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "1", "");
                }
                else
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "2", "");
                }
                ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('" + strResult + "')</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('" + strResult + "')</script>");
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('" + ex.Message + "')</script>");
        }
        BindDDL();
    }