Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            Response.Cache.SetNoStore();
            Response.ExpiresAbsolute = DateTime.Now;
            Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoServerCaching();
            Response.Cache.SetValidUntilExpires(true);
            Response.Cache.SetNoStore();
            Response.Cache.SetExpires(DateTime.Parse(DateTime.Now.ToString()));
            Response.Expires      = -1441;
            Response.CacheControl = "no-cache";
            Response.DisableKernelCache();

            _BuildNbr = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _ErrMsg   = string.Empty;

            string usrname     = string.Empty;
            string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();

            // grab browser data
            string ips = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

            _Browser = new CurrBrowserNoSess(System.Web.HttpContext.Current.Request);
            usrname  = Request.ServerVariables["LOGON_USER"];
            _user    = new CurrentUser(usrname, logFilePath, "");          // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);

            // Access rule
            if (_user == null || !_user.IsValid)
            {
                string AppLog = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
                Log.WriteLogEntry("User Login failed " + usrname, AppLog);
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            // check for specific rights to sales plan tool
            if (!_user.IsInRole("salesplnvw") && !_user.IsAdmin == true)
            {
                Session["NoAccessMsg"] = "You do not have access to the Sales Plan Management Tool.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            _UserID  = Convert.ToInt32(_user.UserID);
            _IsAdmin = 0;
            if (_user.IsAdmin == true)
            {
                _IsAdmin = 1;
            }

            string jsScript = "";

            jsScript = "<script type=\"text/javascript\">var jigEmpID=" + _user.UserID.ToString() + ";var jsgBrowserType='" + _Browser.BrowserType.ToString() + "';var jsgAr=1;var jgA=" + _IsAdmin.ToString() + ";var jsgLoc='" + _LocationCode + "';var jsgError='" + this._ErrMsg + "';</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariables", jsScript);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string usrname   = "";
            int    HideUsers = 0;
            //_PgNbr = 0;
            //_PgSize = 20;
            //this.ddlPageSize.SelectedValue = "20";
            string logFilePath  = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
            string CEnvironment = System.Configuration.ConfigurationManager.AppSettings["Environment"].ToString();

            this.lblEnvironmentName.Text = CEnvironment;
            int    IsAssumed    = 0;
            string AssumedLogin = string.Empty;

            //if (HttpContext.Current.Session["AssumedEntityLogin"] != null)
            //{
            //	if (HttpContext.Current.Session["AssumedEntityLogin"].ToString() != "") { AssumedLogin = HttpContext.Current.Session["AssumedEntityLogin"].ToString(); }
            //}
            if (AssumedLogin != "")
            {
                IsAssumed = 1;
            }
            // grab browser data
            string ips = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

            _Browser = new CurrBrowserNoSess(System.Web.HttpContext.Current.Request);
            usrname  = Request.ServerVariables["LOGON_USER"];
            _user    = new CurrentUser(usrname, logFilePath, AssumedLogin);          // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);

            // Access rule
            if (_user == null || !_user.IsValid)
            {
                string AppLog = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
                Log.WriteLogEntry("User Login failed " + usrname, AppLog);
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            _CBuildNbr = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _UserID    = Convert.ToInt32(_user.UserID);
            this.lblPersonLoggedInName.Text = _user.LastName + ", " + _user.FirstName;

            if (_user.AccessRights > 4 || _user.EditUsers > 4 || _user.IsAdmin == true)
            {
                this.divShowAdminStuff.Style["display"] = "inline-table";
            }

            string jsScript = "";

            jsScript = "<script type=\"text/javascript\">var jCBigEmpID=" + _user.UserID.ToString() + ";var jsgCBBrowserType='" + _Browser.BrowserType.ToString() + "';var jgCBA=" + _user.IsAdmin.ToString().ToLower() + ";var jsgCBPageA='" + _user.PageAdministrators.ToString() + "';var jsgCBAssumd=" + IsAssumed.ToString() + ";var jCBsgError ='" + this._ErrMsg + "';</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariablesCB", jsScript);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            Response.Cache.SetNoStore();
            Response.ExpiresAbsolute = DateTime.Now;
            Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoServerCaching();
            Response.Cache.SetValidUntilExpires(true);
            Response.Cache.SetNoStore();
            Response.Cache.SetExpires(DateTime.Parse(DateTime.Now.ToString()));
            Response.Expires      = -1441;
            Response.CacheControl = "no-cache";
            Response.DisableKernelCache();

            // establish initial and default values
            //_PgNbr = 0;
            _PgRights = 0;
            _PgSize   = 20;
            string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();

            _SiteURL  = System.Configuration.ConfigurationManager.AppSettings["SitePrefix"];
            _BuildNbr = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _AppVers  = System.Configuration.ConfigurationManager.AppSettings["AppVersion"].ToString() + " (" + System.Configuration.ConfigurationManager.AppSettings["AppVersionDate"].ToString() + ")";
            string UserName     = Request.ServerVariables["LOGON_USER"];
            string AssumedLogin = string.Empty;

            if (HttpContext.Current.Session["AssumedEntityLogin"] != null)
            {
                if (HttpContext.Current.Session["AssumedEntityLogin"].ToString() != "")
                {
                    AssumedLogin = HttpContext.Current.Session["AssumedEntityLogin"].ToString();
                }
            }
            _user = new CurrentUser(UserName, logFilePath, AssumedLogin);             // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
            if (_user == null || !_user.IsValid)
            {
                Logging.WriteToLog("Login failed for " + UserName + ".");
                HttpContext.Current.Response.Redirect("NoAcc/NoAccess.aspx", true);
            }
            _Browser = new CurrBrowserNoSess(System.Web.HttpContext.Current.Request);

            _UserID       = Convert.ToInt32(_user.UserID);
            _LocationCode = _user.LocationCode;

            this.lblBuildNbr.Text    = _BuildNbr.ToString();
            this.lblVersion.Text     = System.Configuration.ConfigurationManager.AppSettings["AppVersion"].ToString();
            this.lblVersionDate.Text = System.Configuration.ConfigurationManager.AppSettings["AppVersionDate"].ToString();

            // check for specific rights to forecast consolidation tool
            if (!_user.IsInRole("ordanaladm") && !_user.IsInRole("datmngtview") && !_user.IsInRole("ordanaledt") && !_user.IsInRole("ordanalvw") && !_user.IsAdmin == true && !_user.IsInRole("datmngtedit"))
            {
                //Session["NoAccessMsg"] = "You do not have access to forecasting.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }
            this._CanEdit = true;
            if (_user.IsInRole("ordanaladm") || _user.IsAdmin == true)
            {
                this._IsAdmin  = 1;
                this._PgRights = 5;
            }
            else
            {
                if (_user.IsInRole("ordanalvw") || _user.IsInRole("datmngtview"))
                {
                    this._CanEdit = false;
                    _PgRights     = 1;
                }
            }

            if (!this.IsPostBack)
            {
                try
                {
                    string Loc = _LocationCode;
                    ViewState.Add("LocationCode", _LocationCode);
                    ViewState.Add("PgRights", _PgRights.ToString());
                }
                catch (Exception ex)
                {
                    this._ErrMsg = "Initial data Load encountered an error: " + ex.Message;
                }
            }
            else
            {
                // postback
                _LocationCode = ViewState["LocationCode"].ToString();
                _PgRights     = Convert.ToInt32(ViewState["PgRights"]);
            }

            string jsScript = "";

            jsScript = "<script type=\"text/javascript\">var jigEmpID=" + _user.UserID.ToString() + ";var jsgBrowserType='" + _Browser.BrowserType.ToString() + "';var jsgAr=" + _PgRights.ToString() + ";var jgA=" + _IsAdmin.ToString() + ";var jsgLoc='" + _LocationCode + "';var jsgError ='" + this._ErrMsg + "';</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariables", jsScript);
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            Response.Cache.SetNoStore();
            Response.ExpiresAbsolute = DateTime.Now;
            Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoServerCaching();
            Response.Cache.SetValidUntilExpires(true);
            Response.Cache.SetNoStore();
            Response.Cache.SetExpires(DateTime.Parse(DateTime.Now.ToString()));
            Response.Expires      = -1441;
            Response.CacheControl = "no-cache";
            Response.DisableKernelCache();

            // establish initial and default values
            //_PgNbr = 0;
            _PgRights = 0;
            string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();

            _SiteURL  = System.Configuration.ConfigurationManager.AppSettings["SitePrefix"];
            _BuildNbr = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _AppVers  = System.Configuration.ConfigurationManager.AppSettings["AppVersion"].ToString() + " (" + System.Configuration.ConfigurationManager.AppSettings["AppVersionDate"].ToString() + ")";
            string UserName = Request.ServerVariables["LOGON_USER"];

            _user = new CurrentUser(UserName, logFilePath, "");             // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
            if (_user == null || !_user.IsValid)
            {
                Logging.WriteToLog("Login failed for " + UserName + ".");
                HttpContext.Current.Response.Redirect("NoAcc/NoAccess.aspx", true);
            }
            _Browser = new CurrBrowserNoSess(System.Web.HttpContext.Current.Request);

            _UserID       = Convert.ToInt32(_user.UserID);
            _LocationCode = _user.LocationCode;
            DateTime today = DateTime.Now;

            if (_user.IsAdmin == true)
            {
                _IsAdmin = 1;
            }

            this.lblBuildNbr.InnerText       = _BuildNbr.ToString();
            this.lblVersion.InnerText        = System.Configuration.ConfigurationManager.AppSettings["AppVersion"].ToString();
            this.lblVersionDate.InnerText    = System.Configuration.ConfigurationManager.AppSettings["AppVersionDate"].ToString();
            this.lblCurrentYearFtr.InnerText = today.Year.ToString();

            // check for specific rights to cat tool
            if (!_user.IsInRole("invmngtappr") && !_user.IsInRole("invmngtadm") && !_user.IsInRole("invmngtedt") && !_user.IsInRole("invmngtvw") && _IsAdmin == 0)
            {
                Session["NoAccessMsg"] = "You do not have access to the Inventory Adjustment portion of this application";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            _UserID   = Convert.ToInt32(_user.UserID);
            _InvAdjID = 0;
            if (!string.IsNullOrWhiteSpace(Request["i"]))
            {
                _InvAdjID = Convert.ToInt32(Request["i"]);
            }

            if (_user.IsInRole("invmngtadm") || _user.IsAdmin == true)
            {
                this._IsAdmin  = 1;
                this._PgRights = 5;
            }
            else
            {
                if (_user.IsInRole("invmngtvw") || _user.IsInRole("datmngtview"))
                {
                    _PgRights = 1;
                }
            }
            _RequestTypes = _user.RequestRights;

            string jsScript = "";

            jsScript = "<script type=\"text/javascript\">var jigEmpID=" + _user.UserID.ToString() + ";var jsgBrowserType='" + _Browser.BrowserType.ToString() + "';var jsgAr=" + _PgRights.ToString() + ";var jgA=" + _IsAdmin.ToString() + ";var jsgLoc='" + _LocationCode + "';var jigInvAdj=" + _InvAdjID.ToString() + ";var jsgNm='" + _user.FullName + "';var jsgGrps='" + _RequestTypes + "';var jsgAR=" + _user.AccessRights.ToString() + ";var jsgError='" + this._ErrMsg + "';</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariables", jsScript);
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            Response.Cache.SetNoStore();
            Response.ExpiresAbsolute = DateTime.Now;
            Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoServerCaching();
            Response.Cache.SetValidUntilExpires(true);
            Response.Cache.SetNoStore();
            Response.Cache.SetExpires(DateTime.Parse(DateTime.Now.ToString()));
            Response.Expires      = -1441;
            Response.CacheControl = "no-cache";
            Response.DisableKernelCache();

            // establish initial and default values
            //_PgNbr = 0;
            _PgRights = 0;
            _PgSize   = 20;
            string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();

            _SiteURL  = System.Configuration.ConfigurationManager.AppSettings["SitePrefix"];
            _BuildNbr = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _AppVers  = System.Configuration.ConfigurationManager.AppSettings["AppVersion"].ToString() + " (" + System.Configuration.ConfigurationManager.AppSettings["AppVersionDate"].ToString() + ")";
            string UserName     = Request.ServerVariables["LOGON_USER"];
            string AssumedLogin = string.Empty;

            try
            {
                if (HttpContext.Current.Session["AssumedEntityLogin"] != null)
                {
                    if (HttpContext.Current.Session["AssumedEntityLogin"].ToString() != "")
                    {
                        AssumedLogin = HttpContext.Current.Session["AssumedEntityLogin"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                // nothing
            }
            _user = new CurrentUser(UserName, logFilePath, AssumedLogin);             // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
            if (_user == null || !_user.IsValid)
            {
                Logging.WriteToLog("Login failed for " + UserName + ".");
                HttpContext.Current.Response.Redirect("NoAcc/NoAccess.aspx", true);
            }
            _Browser = new CurrBrowserNoSess(System.Web.HttpContext.Current.Request);

            _UserID       = Convert.ToInt32(_user.UserID);
            _LocationCode = _user.LocationCode;
            _MixCode      = "";
            int CanForecast = 0;

            this.lblBuildNbr.Text    = _BuildNbr.ToString();
            this.lblVersion.Text     = System.Configuration.ConfigurationManager.AppSettings["AppVersion"].ToString();
            this.lblVersionDate.Text = System.Configuration.ConfigurationManager.AppSettings["AppVersionDate"].ToString();

            // check for specific rights to forecast consolidation tool
            if (!_user.IsInRole("forecastAdm") && !_user.IsInRole("datmngtview") && !_user.IsInRole("consoldvw") && !_user.IsInRole("consoldv2") && !_user.IsAdmin == true)
            {
                //Session["NoAccessMsg"] = "You do not have access to forecasting.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }
            if (_user.IsInRole("forecastedit") || _user.IsInRole("forecastview") || _user.IsInRole("forecastAdm") || _user.IsAdmin == true)
            {
                CanForecast = 1;
            }
            this._CanEdit = true;
            if (_user.IsInRole("forecastAdm") || _user.IsAdmin == true)
            {
                this._IsAdmin  = 1;
                this._PgRights = 5;
            }
            else
            {
                if (_user.IsInRole("consoldvw") || _user.IsInRole("datmngtview"))
                {
                    this._CanEdit = false;
                    _PgRights     = 1;
                }
                if (_user.IsInRole("consoldv2"))
                {
                    this._CanEdit = false;
                    _PgRights     = 2;
                }
            }

            if (!this.IsPostBack)
            {
                try
                {
                    string Loc = _LocationCode;
                    _CurrentWeek  = 1;
                    _ForecastView = 0;
                    //System.Globalization.CultureInfo ci =
                    //System.Threading.Thread.CurrentThread.CurrentCulture;
                    //DayOfWeek fdow = ci.DateTimeFormat.FirstDayOfWeek;
                    //DayOfWeek today = DateTime.Now.DayOfWeek;
                    //DateTime sow = DateTime.Now.AddDays(-(today - fdow)).Date;
                    var _TargetDate = DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek + (int)DayOfWeek.Monday);
                    ViewState.Add("TargetDate", _TargetDate.ToString());
                    ViewState.Add("LocationCode", _LocationCode);
                    ViewState.Add("PgRights", _PgRights.ToString());
                    // calculate dates for 13 weeks for header
                    //var monday1 = DateTime.Now.AddDays(-(int)DateTime.Now.DayOfWeek + 5); //1 8 15 22 29 36 43 50 57 64 71 78 85
                }
                catch (Exception ex)
                {
                    this._ErrMsg = "Initial data Load encountered an error: " + ex.Message;
                }
            }
            else
            {
                // postback
                _CurrentWeek  = Convert.ToInt32(ViewState["CurrentWeek"]);
                _TargetDate   = Convert.ToDateTime(ViewState["TargetDate"]);
                _LocationCode = ViewState["LocationCode"].ToString();
                _PgRights     = Convert.ToInt32(ViewState["PgRights"]);
            }

            string jsScript = "";

            jsScript = "<script type=\"text/javascript\">var jigEmpID=" + _user.UserID.ToString() + ";var jsgBrowserType='" + _Browser.BrowserType.ToString() + "';var jsgAr=" + _PgRights.ToString() + ";var jgA=" + _IsAdmin.ToString() + ";var jsgLoc='" + _LocationCode + "';var jigFV=" + CanForecast.ToString() + ";var jsgError ='" + this._ErrMsg + "';</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariables", jsScript);
        }