示例#1
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string strCPwd = objCCWeb.ReturnSingleValue("SELECT UserPassword FROM MTUserMaster WHERE UID=" + Session["UID"]);

        if (strCPwd != FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "SHA1"))
        {
            intCount = intCount + 1;
            if (intCount <= 3)
            {
                //ClientScript.RegisterStartupScript(this.GetType(), "disp", "<script>alert('Incorrect Password');</script>");
                string strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "128_1", "");
                ClientScript.RegisterStartupScript(this.GetType(), "disp", "<script>alert('" + strResult + "');</script>");
            }
            else
            {
                Response.Redirect("~/MainForm.aspx");
            }
            txtPassword.Focus();
        }
        else
        {
            Session["ConfirmPassword"] = "******";
            Response.Redirect(strMenuName);
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strResult   = "";
        int    intSchoolID = 0;

        string[] strArray = this.hidFlag.Value.Split('^');
        try
        {
            List <string> lstArray  = new List <string>();
            byte[]        fileData  = null;
            byte[]        imageData = null;

            long lnLength = 0;

            fUploadEmblem.Attributes["filename"] = hdnSImagePath.Value;
            if (fUploadEmblem.PostedFile.FileName != "")
            {
                if (fUploadEmblem.HasFile)
                {
                    try
                    {
                        Stream myStream = fUploadEmblem.PostedFile.InputStream;
                        lnLength = myStream.Length;
                        fileData = new byte[(int)myStream.Length];
                        myStream.Read(fileData, 0, (int)lnLength);
                        myStream.Close();
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            string strEmblemStatus;
            if (rbtnYes.Checked == true)
            {
                strEmblemStatus = "Y";
            }
            else
            {
                strEmblemStatus = "N";
            }
            //if (strArray[0] == "N" || strArray[0]=="E" && strArray[3].Trim().ToUpper() != txtAddress.Text.Trim().ToUpper())
            //{
            //    if (objCCWeb.ReturnNumericValue("SELECT COUNT(SchoolID) FROM MTClientCompany WHERE Address='" + txtAddress.Text.Trim().Replace("'", "''") + "'") > 0)
            //    {
            //        strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblAddress.Text);
            //        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>" + strHideID + "alert('" + strResult + "')</script>");
            //        //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>" + strHideID + "alert('Address Already Exist')</script>");
            //        hidFlag.Value = "S";
            //        return;
            //    }
            //}
            if (strArray[0] == "E")
            {
                lstArray.Add("UPDATE MTClientCompany SET SchoolName1=" + objCCWeb.fReplaceChar(txtInstitution1) + ",SchoolName2='" + txtInstitution2.Text.Trim().Replace("'", "''") + "',Address=" + objCCWeb.fReplaceChar(txtAddress) + ",ReportHeader=" + objCCWeb.fReplaceChar(txtReportHeader) +
                             ",City=" + objCCWeb.fReplaceChar(txtCity) + ",State=" + objCCWeb.fReplaceChar(txtState) + ",Pincode=" + objCCWeb.fReplaceChar(txtPincode) + ",Telephone=" + objCCWeb.fReplaceChar(txtTelephone) + "," +
                             "Fax=" + objCCWeb.fReplaceChar(txtFax) + ",Email=" + objCCWeb.fReplaceChar(txtEmail) + ",DirectorName=" + objCCWeb.fReplaceChar(txtDirector) + ",DirectorTelephone=" + objCCWeb.fReplaceChar(txtDirPhone) +
                             ",PrincipalName=" + objCCWeb.fReplaceChar(txtPrincipal) + ",PrincipalPhone=" + objCCWeb.fReplaceChar(txtPriPhone) + ",VicePrincipalName=" + objCCWeb.fReplaceChar(txtVicePrincipal) + "," +
                             "VicePrincipalPhone=" + objCCWeb.fReplaceChar(txtVicePriPhone) + ",AdministratorName=" + objCCWeb.fReplaceChar(txtAdministrator) + ",AdministratorPhone=" + objCCWeb.fReplaceChar(txtAdmPhone) + ",Affiliation=" + objCCWeb.fReplaceChar(txtAffiliation) +
                             ",Medium=" + objCCWeb.fReplaceChar(txtMedium) + ",Motto=" + objCCWeb.fReplaceChar(txtMotto) + ",EstablishedOn=" + objCCWeb.fReplaceChar(txtEstablishedOn) + ",EstablishmentCode=" + objCCWeb.fReplaceChar(txtEstablishmentCode) + "," +
                             "BankAccountNo=" + objCCWeb.fReplaceChar(txtBankACNo) + ",EmblemStatus='" + strEmblemStatus + "',UpdateUserID=" + Session["UID"].ToString() + ",UpdateDate=GETDATE(),PLPackDate=" + objCCWeb.ReturnDateorNull(txtPLPackDate.Text.Trim()) + ",PLPackdateStaff=" + objCCWeb.ReturnDateorNull(txtPLPackDateStaff.Text.Trim()) + " WHERE SchoolID=" + strArray[1] + "");

                lstArray.Add("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 Modified')");
            }
            else
            {
                intSchoolID = objCCWeb.ReturnNumericValue("SELECT ISNULL(MAX(SchoolID),0)+1 FROM MTClientCompany");

                lstArray.Add("INSERT INTO MTClientCompany(SchoolID,SchoolName1,SchoolName2,Address,ReportHeader,City,State,Pincode,Telephone,Fax,Email,DirectorName,DirectorTelephone,PrincipalName,PrincipalPhone,VicePrincipalName,VicePrincipalPhone,AdministratorName,AdministratorPhone," +
                             "Affiliation,Medium,Motto,EstablishedOn,EstablishmentCode,BankAccountNo,EmblemStatus,EntryUserID,EntryDate) SELECT ISNULL(MAX(SchoolID),0)+1, '" + txtInstitution1.Text.Trim().Replace("'", "''") + "','" + txtInstitution2.Text.Trim().Replace("'", "''") + "','" + txtAddress.Text.Trim().Replace("'", "''") + "','" + txtReportHeader.Text.Trim().Replace("'", "''") +
                             "','" + txtCity.Text.Trim().Replace("'", "''") + "','" + txtState.Text.Trim().Replace("'", "''") + "','" + txtPincode.Text.Trim().Replace("'", "''") + "','" + txtTelephone.Text.Trim().Replace("'", "''") + "'," +
                             "'" + txtFax.Text.Trim().Replace("'", "''") + "','" + txtEmail.Text.Trim().Replace("'", "''") + "','" + txtDirector.Text.Trim().Replace("'", "''") + "','" + txtDirPhone.Text.Trim().Replace("'", "''") +
                             "','" + txtPrincipal.Text.Trim().Replace("'", "''") + "','" + txtPriPhone.Text.Trim().Replace("'", "''") + "','" + txtVicePrincipal.Text.Trim().Replace("'", "''") + "'," +
                             "'" + txtVicePriPhone.Text.Trim().Replace("'", "''") + "','" + txtAdministrator.Text.Trim().Replace("'", "''") + "','" + txtAdmPhone.Text.Trim().Replace("'", "''") + "','" + txtAffiliation.Text.Trim().Replace("'", "''") +
                             "','" + txtMedium.Text.Trim().Replace("'", "''") + "','" + txtMotto.Text.Trim().Replace("'", "''") + "','" + txtEstablishedOn.Text.Trim().Replace("'", "''") + "','" + txtEstablishmentCode.Text.Trim().Replace("'", "''") + "'," +
                             "'" + txtBankACNo.Text.Trim().Replace("'", "''") + "','" + strEmblemStatus + "'," + Session["UID"].ToString() + ",GETDATE() FROM MTClientCompany");
            }
            strResult = objCCWeb.ExecuteQueryList(lstArray);
            if (strArray[0] == "E")
            {
                intSchoolID = Convert.ToInt32(strArray[1]);
            }

            if (hidFlag.Value == "N^")
            {
                hidFlag.Value = "N^";
            }
            else
            {
                hidFlag.Value = "E^";
            }
            if (strResult == "")
            {
                if (lnLength > 0)
                {
                    //SqlConnection conSImage = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings.Get("ConnectionString"));
                    SqlConnection conSImage = new SqlConnection(objCCWeb.ReturnConnectionString());
                    conSImage.Open();
                    SqlCommand cmdSImage = new SqlCommand("UPDATE MTClientCompany SET Emblem=@img,EmblemLength=" + lnLength.ToString() + " where SchoolID=" + intSchoolID + "", conSImage);
                    cmdSImage.CommandType = CommandType.Text;
                    cmdSImage.Parameters.Add(new SqlParameter("@img", SqlDbType.Image));
                    cmdSImage.Parameters["@img"].Value = fileData;
                    cmdSImage.ExecuteNonQuery();
                    conSImage.Close();
                    conSImage.Dispose();
                }
                if (lnLength == 0)
                {
                    if (strArray[0] == "E")
                    {
                        SqlDataReader rdrImage = objCCWeb.BindReader("SELECT ISNULL(Emblem,'') AS Emblem,CAST(ISNULL(EmblemLength,0) AS INT) AS EmblemLength FROM MTClientCompany WHERE SchoolID=" + intSchoolID + "");
                        if (rdrImage.Read())
                        {
                            int intLength = (int)rdrImage["EmblemLength"];
                            imageData = new byte[intLength];
                            imageData = (byte[])rdrImage["Emblem"];
                            if (intLength != 0)
                            {
                                lnLength = intLength;
                            }
                        }
                        rdrImage.Close();
                        rdrImage.Dispose();
                    }
                }
                if (strArray[0] == "N")
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "1", "");
                }
                else
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "2", "");
                }
                ClientScript.RegisterStartupScript(this.GetType(), "displayScriptMsg", "<script>" + strHideID + "alert('" + strResult + "')</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "displayE", "<script language=javascript>" + strHideID + "alert('" + strResult + "')</script>");
            }
            if (fUploadEmblem.PostedFile.FileName == "")
            {
                fileData = imageData;
            }
            btnCancel_Click(sender, e);
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>" + strHideID + "alert('" + ex.Message + "')</script>");
        }
        BindDDL();
        btnCancel_Click(sender, e);
    }
示例#3
0
    //protected static string strHideID = " document.getElementById('trReportGroup').style.display='none';" +
    //    "if (document.getElementById('gvReportGroup')!=null){if (document.getElementById('gvReportGroup').rows.length>1) {for(var intForLoop=0;intForLoop<document.getElementById('gvReportGroup').rows.length;intForLoop++)" +
    //        " {  document.getElementById('gvReportGroup').rows[intForLoop].cells[1].style.display='none'; " +
    //       // " document.getElementById('gvReportGroup').rows[intForLoop].cells[4].style.display='none'; "  +
    //        "document.getElementById('divSelectDeSelect').style.display='none';}}}";

    //protected static string strHidepriority = "if(document.getElementById('gvReportGroup')!=null) " +
    //                               " if(document.getElementById('gvReportGroup').rows.length>1) " +
    //                               "  for(var varLoop= 0 ; varLoop<document.getElementById('gvReportGroup').rows.length;varLoop++) { " +
    //                               " document.getElementById('gvReportGroup').rows[varLoop].cells[5].style.display='none'; }";

    protected void Page_Load(object sender, EventArgs e)
    {
        //ClientScript.RegisterStartupScript(this.GetType(), "disScript", "<script language='javascript'>" + strHideID + "</script>");
        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=1 AND MenuName='mnuReportGroupMaster'") == 0) || (objCCWeb.ReturnSingleValue("SELECT ISNULL(VisibleOption,'N') FROM MTUserLimitMaster WHERE UID=" + Session["UID"] + " AND ModuleID=1 AND MenuName='mnuReportGroupMaster'") == "N"))
        {
            Session.Clear();
            Response.Redirect("Logon.aspx");
            return;
        }
        if (objCCWeb.pCheckText(frmReportGroupMaster) == true)
        {
            Response.Write("<script>window.close();window.open('Logon.aspx','_Parent');</script>");
            return;
        }
        if ((Session["Type"] == null) || (Session["Type"].ToString() == "1"))
        {
            strType = "ltr";
        }
        else
        {
            strType = "rtl";
            pnlClassSection.HorizontalAlign = HorizontalAlign.Right;
        }
        if (!IsPostBack)
        {
            hidCache.Value = "";
            pGetOption();
            gvReportGroup.Attributes.Add("bordercolor", "#FFC1A4");
            txtReportGroupName1.Attributes.Add("onkeypress", "javascript:return Restrict_Name(event)");
            txtReportGroupName2.Attributes.Add("onkeypress", "javascript:return Restrict_NameArabic(event)");
            txtpriority.Attributes.Add("onkeypress", "javascript:return Restrict_Priority(event)");
            txtReportGroupName2.Style.Add("text-align", "right");
            txtReportGroupName1.Attributes.Add("AutoComplete", "off");
            txtReportGroupName2.Attributes.Add("AutoComplete", "off");
            gvReportGroup.Attributes.Add("onkeypress", "javascript:return searchName(event,'gvReportGroup',2)");
            objCCWeb.FillDDLs(ddlModuleID, "SELECT 0 AS ModuleID,'' AS ModuleName" + Session["Type"] + " UNION Select Distinct MTRM.ModuleID,MTUMM.ModuleNAME From MTReportMaster MTRM Inner JOIN MTUserModuleMaster MTUMM ON MTRM.ModuleID=MTUMM.ModuleID  WHERE MTRM.ModuleID>'0'  ORDER BY ModuleID ", "ModuleID", "ModuleName" + Session["Type"].ToString() + "", "");

            //objCCWeb.FillCheckedBoxList(chkReportName, "SELECT ReportID,ReportName" + Session["Type"] + " FROM MTReportMaster WHERE ReportID>0 ORDER BY ReportID, ReportName" + Session["Type"] + " ", "ReportID", "ReportName" + Session["Type"].ToString() + "", "");

            btnCancel_Click(sender, e);

            //pDisplayType();
            gvReportGroup.EmptyDataText = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "1023", "");
            btnSelectAll.Attributes.Add("onclick", "javascript:return fClassSubject(1);");
            btnDeSelect.Attributes.Add("onclick", "javascript:return fClassSubject(0);");
            chkReportName.Attributes.Add("oncontextmenu", "javascript:return fSelectDeSelect(event)");
            if (ddlModuleID.Items.Count > 0)
            {
                ddlModuleID.Items[0].Text = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "6", lblReportModuleID.Text);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "DisplayScript", "<script language='javascript'>" + strHideID + "</script>");
            chkReportName.Items.Add(new ListItem("", ""));
        }
    }
示例#4
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();
    }