Beispiel #1
0
    void Application_Error(object sender, EventArgs e)
    {
        // Code that runs when an unhandled error occurs
        string erroremailuser = "******";
        try
        {
            GK3_Driver mydrive = new GK3_Driver();
            System.Data.DataSet myds = new DataSet();
            myds = mydrive.AllUserINFO(HttpContext.Current.User.Identity.Name.ToString());

             erroremailuser = myds.Tables[0].Rows[0]["txt_email"].ToString();
        }
        catch
        {
        }

        try
        {

          Exception objErr = Server.GetLastError().GetBaseException();

          string emailrecps = WebConfigurationManager.AppSettings["ErrorEmails"].ToString();

            MailMessage mm = new MailMessage(erroremailuser,emailrecps);
            mm.Subject = HttpContext.Current.User.Identity.Name.ToString() + " caused an error";

            mm.Body = erroremailuser + "   Has caused an error" + Environment.NewLine + Environment.NewLine + Environment.NewLine + "*******************Details ****************" + Environment.NewLine + Environment.NewLine + "**************Message**************" + Environment.NewLine + objErr.Message.ToString() + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + "*********Stack Trace *****************" + Environment.NewLine + objErr.StackTrace + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + "****************Offending Page ******************" + Environment.NewLine + Request.Url;
            SmtpClient smtp = new SmtpClient();
            smtp.UseDefaultCredentials  = true;
            smtp.Send(mm);
            if (objErr.GetType().ToString() == "System.Data.SqlClient.SqlException")
            {

                Response.Redirect("http://localhost/perkins_vers2/General_UserError.aspx");

            }
            //if (Session[Session.SessionID + "USERID"] == null)
            if (Context.Session == null || Context.Session.IsNewSession)
            {
              //  Response.Redirect("http://localhost/perkins_vers2/SessionTimeOut.aspx");
            }
            else
            {

            //    Response.Redirect("http://localhost/perkins_vers2/UnexpectedError.aspx");
            }
        }
        catch (Exception ex)
        {
            string mystring = ex.Message;
            string mestring = "filler";

           // Response.Redirect("http://localhost/perkins_vers2/UnexpectedError.aspx");

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            try
            {
                if (Session[Session.SessionID + "finishstat"] != null && Session[Session.SessionID + "finishstat"].ToString() == "false")
                    CleanUP_UnFinished_activities(Session[Session.SessionID + "keyactiveID"].ToString());
            }
            catch
            {
            }
        }

        if (!Page.IsPostBack)
        {
          //  PerkinsTab_DV("-1", "-1");
        }

        Rad_tabNavigation.Align = Telerik.Web.UI.TabStripAlign.Left;
          //  Session[Session.SessionID + "ChildTabIndex"]

        if (!Page.IsPostBack)
            CreateRootTab(Convert.ToInt16(Session[Session.SessionID + "ParentTabIndex"].ToString()), Session[Session.SessionID + "ParentTabValue"].ToString());

        if (this.ContentPlaceHolder1.Page.ToString() == "ASP.administration_collegeusers_aspx")
        {
            this.lblCollege.Visible = false;
            this.Label2.Visible = false;
            this.DropDownList1.Visible = false;
            this.DropDownList2.Visible = false;

        }
        else
        {
            this.lblCollege.Visible = true;
            this.Label2.Visible = true;
            this.DropDownList1.Visible = true;
            this.DropDownList2.Visible = true;
        }
        if (!IsPostBack)
        {

            if (Session[Session.SessionID + "roleid"].ToString() != "101")
            {

                //RL added for new tab control
               // Telerik.WebControls.Tab AdminTab = RAD_tabNav_Parent_Strip.Tabs[RAD_tabNav_Parent_Strip.Tabs.IndexOf(RAD_tabNav_Parent_Strip.FindTabByText("Administration"))];
               // AdminTab.Enabled = false;
                //
                try
                {
                    Telerik.WebControls.RadPanelItem adminitem = RadPanelbar1.Items[RadPanelbar1.Items.IndexOf(RadPanelbar1.Items.FindItemByText("Administration"))];
                    adminitem.Enabled = false;
                    adminitem.Expanded = false;
                }
                catch
                {
                }
            }

            if (Session[Session.SessionID + "roleid"].ToString() == "103" || Session[Session.SessionID + "roleid"].ToString() == "102" || Session[Session.SessionID + "roleid"].ToString() == "104")
            {
                DropDownList1.Enabled = false;

            }

            try
            {
                DropDownList1.DataSource = this.SqlDsCollege;
                DropDownList1.DataTextField = "txt_college_short_name";
                DropDownList1.DataValueField = "key_college_id";
                DropDownList1.DataBind();

                DropDownList2.DataSource = SqlDS_fisYear;
                DropDownList2.DataTextField = "nbr_fiscal_year";
                DropDownList2.DataValueField = "nbr_fiscal_year";
                DropDownList2.DataBind();
            }
            catch (Exception ex)
            {

            }

            GK3_Driver mydrive = new GK3_Driver();
            DataSet myds = new DataSet();
            myds = mydrive.AllUserINFO(HttpContext.Current.User.Identity.Name.ToString());

            try
            {
                string teststring = myds.Tables[0].Rows[0][0].ToString();

                if (Session[Session.SessionID + "USERID"] != null)
                {
                    Session.Remove(Session.SessionID + "USERID");
                }
                Session.Add(Session.SessionID + "USERID", myds.Tables[0].Rows[0]["key_user_id"].ToString());
                //////////////////////
                if (Session[Session.SessionID + "email"] != null)
                {
                    Session.Remove(Session.SessionID + "email");
                }
                Session.Add(Session.SessionID + "email", myds.Tables[0].Rows[0]["txt_email"].ToString());
                //////////////////////
                if (Session[Session.SessionID + "diplayname"] != null)
                {
                    Session.Remove(Session.SessionID + "displayname");
                }
                Session.Add(Session.SessionID + "displayname", myds.Tables[0].Rows[0]["txt_display_name"].ToString());
                ////////////////////////

                if (Session[Session.SessionID + "roleid"] != null)
                {
                    Session.Remove(Session.SessionID + "roleid");
                }
                Session.Add(Session.SessionID + "roleid", myds.Tables[0].Rows[0]["key_role_id"].ToString());

            }
            catch
            {
            }

        }
    }
Beispiel #3
0
    void Session_Start(object sender, EventArgs e)
    {
        GK3_Driver mydrive = new GK3_Driver();
        System.Data.DataSet myds = new DataSet();

        Session.Timeout = 600;

        try
        {

            if (Session[Session.SessionID + "ChildTabIndex"] != null)
            {
                Session.Remove(Session.SessionID + "ChildTabIndex");
            }
            Session.Add(Session.SessionID + "ChildTabIndex", "-1");
            if (Session[Session.SessionID + "ChildTabValue"] != null)
            {
                Session.Remove(Session.SessionID + "ChildTabValue");
            }
            Session.Add(Session.SessionID + "ChildTabValue", "-1");

            if (Session[Session.SessionID + "ChildURLValue"] != null)
            {
                Session.Remove(Session.SessionID + "ChildURLValue");
            }
            Session.Add(Session.SessionID + "ChildURLValue", "");

            if (Session[Session.SessionID + "ParentTabIndex"] != null)
            {
                Session.Remove(Session.SessionID + "ParentTabIndex");
            }
            Session.Add(Session.SessionID + "ParentTabIndex", "-1");

            if (Session[Session.SessionID + "ParentTabValue"] != null)
            {
                Session.Remove(Session.SessionID + "ParentTabValue");
            }
            Session.Add(Session.SessionID + "ParentTabValue", "-1");

            myds = mydrive.AllUserINFO(HttpContext.Current.User.Identity.Name.ToString());
            string teststring = myds.Tables[0].Rows[0][0].ToString();

            if (Session[Session.SessionID + "USERID"] != null)
            {
                Session.Remove(Session.SessionID + "USERID");
            }
            Session.Add(Session.SessionID + "USERID", myds.Tables[0].Rows[0]["key_user_id"].ToString());
            //////////////////////
            if (Session[Session.SessionID + "email"] != null)
            {
                Session.Remove(Session.SessionID + "email");
            }
            Session.Add(Session.SessionID + "email", myds.Tables[0].Rows[0]["txt_email"].ToString());
            //////////////////////
            if (Session[Session.SessionID + "diplayname"] != null)
            {
                Session.Remove(Session.SessionID + "displayname");
            }
            Session.Add(Session.SessionID + "displayname", myds.Tables[0].Rows[0]["txt_display_name"].ToString());
            //////////////////////

            if (Session[Session.SessionID + "roleid"] != null)
            {
                Session.Remove(Session.SessionID + "roleid");
            }
            Session.Add(Session.SessionID + "roleid", myds.Tables[0].Rows[0]["key_role_id"].ToString());
            //////////////////////
            if (Session[Session.SessionID + "Userscollege"] != null)
            {
                Session.Remove(Session.SessionID + "userscollege");
            }
            Session.Add(Session.SessionID + "userscollege", myds.Tables[0].Rows[0]["key_college_id"].ToString());
            //////////////////////

            if (Session[Session.SessionID + "CollegeDDvalue"] != null)
            {
                Session.Remove(Session.SessionID + "CollegeDDvalue");
            }
            Session.Add(Session.SessionID + "CollegeDDvalue", myds.Tables[0].Rows[0]["key_college_id"].ToString());

        }
        catch (Exception ex)
        {
           Response.Redirect("~/access_denied.aspx");
           //       Response.Write(ex.Message.ToString());
        }
    }
Beispiel #4
0
    public void sendEmail(string st_subject, string st_body, string st_receivers)
    {
        try
        {
            if (st_receivers.Trim() != "")
            {
                GK3_Driver mydrive = new GK3_Driver();
                System.Data.DataSet myds = new DataSet();
                myds = mydrive.AllUserINFO(HttpContext.Current.User.Identity.Name.ToString());

                string erroremailuser = myds.Tables[0].Rows[0]["txt_email"].ToString();

                MailMessage mm = new MailMessage("*****@*****.**", st_receivers);

                if (HttpContext.Current.Server.MachineName.ToLower() == "vdogwood")
                    mm.Subject = "TESTING - " + st_subject;
                else
                    mm.Subject = st_subject;

                mm.Bcc.Add("[email protected],[email protected]");

                mm.IsBodyHtml = true;
                mm.Body = st_body;
                SmtpClient smtp = new SmtpClient();
                smtp.UseDefaultCredentials = true;
                smtp.Send(mm);
            }
        }
        catch { }
    }