Ejemplo n.º 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();

            // establish initial and default values
            //this.divLoadingGif.Style["display"] = "block";
            this.lblErrorMsg.Text = "";
            string usrname = "";
            //_PgNbr = 0;
            //_PgSize = 20;
            //this.ddlPageSize.SelectedValue = "20";
            string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();

            // grab browser data
            //if (Session["CurrentUser"] == null)
            //{
            string ips           = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
            string CurrSessionID = System.Web.HttpContext.Current.Session.SessionID;

            _Browser = new CurrBrowser(System.Web.HttpContext.Current.Request);
            //}
            //else
            //{
            //    _Browser = (CurrBrowser)Session["bw"];
            //}

            string AssumedLogin = string.Empty;

            if (HttpContext.Current.Session["AssumedEntityLogin"] != null)
            {
                if (HttpContext.Current.Session["AssumedEntityLogin"].ToString() != "")
                {
                    AssumedLogin = HttpContext.Current.Session["AssumedEntityLogin"].ToString();
                }
            }


            // check for user rights to this page
            //if (Session["UserName"] == null)
            //       {
            //           usrname = Request.ServerVariables["LOGON_USER"];
            //           HttpContext.Current.Session["UserName"] = usrname;
            //       }
            //       else
            //       {
            //       }
            usrname = HttpContext.Current.Session["UserName"].ToString();
            _user   = new CurrentUser(usrname, logFilePath, AssumedLogin);           // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);

            //_user = (CurrentUser)HttpContext.Current.Session["CurrentUser"];

            // get user object and put it in the session
            if (_user == null)
            {
                if (HttpContext.Current.Session["CurrentUser"] != null)
                {
                    _user = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
                }
                else
                {
                    _user = new CurrentUser(usrname, logFilePath, ""); // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
                    HttpContext.Current.Session["CurrentUser"] = _user;
                }
            }
            // Access rule
            if (_user == null || !_user.IsValid)
            {
                string AppLog = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
                Log.WriteLogEntry("User Login failed " + usrname, AppLog);
                Session["NoAccessMsg"] = "You do not have access to the products search application";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            // check for specific rights to cat tool
            if (_user.AccessRights < 2 && _user.CatToolRights == 0)
            {
                Session["NoAccessMsg"] = "You do not have access to the Products Search Tool.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            _CBuildNbr = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _UserID    = Convert.ToInt32(_user.UserID);

            strSessionVariableName = string.Concat(_user.UserID.ToString(), SearchProductsDataLayer.TableName);

            if (!this.IsPostBack)
            {
                tblType.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));

                tblCode.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));

                tblSpecie.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblSpecie.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblColor.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblColor.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblGrade.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblGrade.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblSeasoning.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblSeasoning.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblSurface.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblSurface.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblRework.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblRework.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblSort.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblSort.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblCertification.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblCertification.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblOthers.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblOthers.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblOwner.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblOwner.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblWidth.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblWidth.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblLength.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblLength.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblThickness.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblThickness.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblAdd1.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblAdd1.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                tblAdd2.Columns.Add(new DataColumn(SearchProductsDataLayer.CodeCol, typeof(string)));
                tblAdd2.Columns.Add(new DataColumn(SearchProductsDataLayer.DescriptionCol, typeof(string)));

                // main data table, lot of columns in this puppy
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldTypeCol, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldCodeCol, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldDescriptionCol, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewTypeCol, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewCodeCol, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDescriptionCol, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldDesc1Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldDesc2Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldDesc3Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldDesc4Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldDesc5Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldDesc6Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.OldDesc7Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc1Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc2Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc3Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc4Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc5Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc6Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc7Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc8Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc9Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc10Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc11Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc12Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc13Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc14Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.NewDesc15Col, typeof(string)));
                tblMain.Columns.Add(new DataColumn(SearchProductsDataLayer.ProductLinkIdCol, typeof(long)));

                tblType = DataObj.GetProductTypeList();
                drpProdTypes.DataSource = tblType;
                drpProdTypes.DataBind();
                drpProdTypes.SelectedIndex = 0;
                drpCodeList.Enabled        = false;

                drpProFilter.DataSource = tblType;
                drpProFilter.DataBind();
                drpProFilter.SelectedIndex = 0;

                divDataGrid.Visible = false;
                drpAdd1.Enabled     = false;
                drpOwner.Enabled    = false;
                drpAdd2.Enabled     = false;
            }
        }
Ejemplo n.º 2
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();

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

            // grab browser data
            if (Session["CurrentUser"] == null)
            {
                string ips           = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                string CurrSessionID = System.Web.HttpContext.Current.Session.SessionID;
                _Browser = new CurrBrowser(System.Web.HttpContext.Current.Request);
            }
            else
            {
                _Browser = (CurrBrowser)Session["bw"];
            }

            // check for user rights to this page
            if (Session["UserName"] == null)
            {
                usrname = Request.ServerVariables["LOGON_USER"];
                HttpContext.Current.Session["UserName"] = usrname;
            }
            else
            {
                usrname = HttpContext.Current.Session["UserName"].ToString();
            }

            // get user object and put it in the session
            if (_user == null)
            {
                if (HttpContext.Current.Session["CurrentUser"] != null)
                {
                    _user = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
                }
                else
                {
                    _user = new CurrentUser(usrname, logFilePath, "");                     // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
                    HttpContext.Current.Session["CurrentUser"] = _user;
                }
            }
            // Access rule
            if (_user == null || !_user.IsValid)
            {
                string AppLog = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
                Log.WriteLogEntry("User Login failed " + usrname, AppLog);
                Session["NoAccessMsg"] = "You do not have access to this application";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }
            if (_user.AccessRights < 1)
            {
                Session["NoAccessMsg"] = "You do not have access to this application.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            _CBuildNbr = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _UserID    = Convert.ToInt32(_user.UserID);

            if (_user.IsInRole("hitscompvw") && _user.IsAdmin == false)
            {
                this.rowComputerAsset.Style["display"] = "none";
            }

            if (!_user.IsInRole("catAdmin") && !_user.IsInRole("catprcedit") && !_user.IsInRole("catAdmin") && !_user.IsInRole("datamngtcat") && _user.IsAdmin == false)
            {
                this.rowCatItems.Style["display"] = "none";
            }

            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit"))
            {
                this.rowEntities.Style["display"]             = "block";
                this.rowLocations.Style["display"]            = "block";
                this.rowEntities.Style["display"]             = "block";
                this.rowCatTool.Style["display"]              = "block";
                this.rowProcOwner.Style["display"]            = "block";
                this.rowInvAdj.Style["display"]               = "block";
                this.rowARAging.Style["display"]              = "block";
                this.rowProdForecast.Style["display"]         = "block";
                this.rowForecastConsolidaton.Style["display"] = "block";
                this.rowWurthTags.Style["display"]            = "block";
                this.rowSalesPlan.Style["display"]            = "block";
                this.rowSalesPlan2.Style["display"]           = "block";
                this.rowSalesPlanspacer.Style["display"]      = "block";
                this.rowWurthSpacer.Style["display"]          = "block";
                this.rowEmailManagement.Style["display"]      = "block";
                this.rowProcManagement.Style["display"]       = "block";
                this.rowUserADInterface.Style["display"]      = "block";
                this.rowWurthConvert.Style["display"]         = "block";
                this.rowRequestMngt.Style["display"]          = "block";
                this.rowIssueMngt.Style["display"]            = "block";
                this.rowComments.Style["display"]             = "block";
                this.rowWeeklyRpt.Style["display"]            = "block";
                this.rowInvAnalysis.Style["display"]          = "block";
            }
            else
            {
                // hide all rows by default if not administrator or full edit
                this.rowEntities.Style["display"]  = "none";
                this.rowCatTool.Style["display"]   = "none";
                this.rowLocations.Style["display"] = "none";
                //this.rowUsers.Style["display"] = "none";
                this.rowProcOwner.Style["display"]            = "none";
                this.rowInvAdj.Style["display"]               = "none";
                this.rowARAging.Style["display"]              = "none";
                this.rowForecastConsolidaton.Style["display"] = "none";
                this.rowSalesPlan.Style["display"]            = "none";
                this.rowSalesPlan2.Style["display"]           = "none";
                this.rowSalesPlanspacer.Style["display"]      = "none";
                //this.rowWurthTags.Style["display"] = "none";
                //this.rowWurthSpacer.Style["display"] = "none";
                this.rowComputerAssetSpacer.Style["display"] = "none";
                this.rowComputerAsset.Style["display"]       = "none";
                this.rowEmailManagement.Style["display"]     = "none";
                this.rowProcManagement.Style["display"]      = "none";
                this.rowUserADInterface.Style["display"]     = "none";
                this.rowWurthConvert.Style["display"]        = "none";
                this.rowRequestMngt.Style["display"]         = "block";
                this.rowIssueMngt.Style["display"]           = "none";
                this.rowComments.Style["display"]            = "none";
                this.rowInvAnalysis.Style["display"]         = "none";
                this.rowProdForecast.Style["display"]        = "none";

                // selectively show lines based on individual rights set
                if (_user.IsInRole("forecastadm") || _user.IsInRole("forecastedit") || _user.IsInRole("forecastview"))
                {
                    this.rowProdForecast.Style["display"] = "block";
                }
                if (_user.IsInRole("datmngtVend"))
                {
                    this.rowEntities.Style["display"] = "block";
                }
                if (_user.IsInRole("datmngtLoc"))
                {
                    this.rowLocations.Style["display"] = "block";
                }
                if (_user.IsInRole("cowkrptvw") || _user.IsInRole("cowkrptedt") || _user.IsInRole("cowkrptadm"))
                {
                    this.rowWeeklyRpt.Style["display"] = "block";
                }
                //if (_user.IsInRole("datmngtUser"))
                //{
                //	this.rowUsers.Style["display"] = "block";
                //}
                if (_user.IsInRole("datmngtCust"))
                {
                    this.rowEntities.Style["display"] = "block";
                }
                if (_user.IsInRole("datmngtCat") || _user.IsInRole("catview") || _user.IsInRole("catAdmin") || _user.IsInRole("catprcedit") || _user.IsInRole("prodavlvw") || _user.IsInRole("prodavlad") || _user.IsInRole("prodavled") || _user.IsInRole("saleslead"))
                {
                    this.rowCatTool.Style["display"] = "block";
                }
                if (_user.IsInRole("catprcedit"))
                {
                    rowCatItems.Style["display"] = "block";
                }
                if (_user.IsInRole("consoldvw") || _user.IsInRole("consoldv2"))
                {
                    this.rowForecastConsolidaton.Style["display"] = "block";
                }
                if (_user.IsInRole("wurthedt"))
                {
                    rowWurthTags.Style["display"]   = "block";
                    rowWurthSpacer.Style["display"] = "block";
                }
                if (_user.ProcOwnerRight > 0)
                {
                    this.rowProcOwner.Style["display"] = "block";
                }
                if (_user.IsInRole("invadjadm") || _user.IsInRole("invadjedit") || _user.IsInRole("invadjview") || _user.IsInRole("invadjapprv"))
                {
                    this.rowInvAdj.Style["display"] = "block";
                }
                if (_user.IsInRole("creditmgr") || _user.IsInRole("cersubmit") || _user.IsInRole("credexcvw") || _user.IsInRole("credapprover"))
                {
                    this.rowCreditExcReq.Style["display"] = "block";
                }
                if (_user.AccessARAgingRpt > 0)
                {
                    this.rowARAging.Style["display"] = "block";
                }
                if (_user.IsInRole("salesplnvw") || _user.IsInRole("salesplnAdm"))
                {
                    this.rowSalesPlanspacer.Style["display"] = "block";
                    this.rowSalesPlan.Style["display"]       = "block";
                    //this.rowSalesPlan2.Style["display"] = "block";
                }
                if (_user.IsInRole("salesplnAdm"))
                {
                    this.rowSalesPlan2.Style["display"] = "block";
                }

                if (_user.IsInRole("hitscompvw") || _user.IsInRole("hitscompedt") || _user.IsInRole("compassedt") || _user.IsInRole("compasset") || _user.IsInRole("compassadm"))
                {
                    this.rowComputerAssetSpacer.Style["display"] = "block";
                    this.rowComputerAsset.Style["display"]       = "block";
                }

                if (_user.IsInRole("wurthcdedt") || _user.IsInRole("wurthcdvw") || _user.IsInRole("wurthcdadm"))
                {
                    this.rowWurthConvert.Style["display"] = "block";
                }

                //if (_user.IsInRole("reqapprvw") || _user.IsInRole("reqappredt") || _user.IsInRole("reqappradm"))
                //{
                //	this.rowRequestMngt.Style["display"] = "block";
                //}

                if (_user.IsInRole("cmtmngtvw") || _user.IsInRole("cmtmngtedt") || _user.IsInRole("cmtmngtadm"))
                {
                    this.rowComments.Style["display"] = "block";
                }

                if (_user.IsInRole("invmngtview") || _user.IsInRole("invmngtadm") || _user.IsInRole("invmngtedt"))
                {
                    this.rowInvAnalysis.Style["display"] = "block";
                }
            }
        }
Ejemplo n.º 3
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
            string usrname = "";

            //_PgNbr = 0;
            _PgSize = 20;
            string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();

            // grab browser data
            if (Session["CurrentUser"] == null)
            {
                string ips           = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                string CurrSessionID = System.Web.HttpContext.Current.Session.SessionID;
                _Browser = new CurrBrowser(System.Web.HttpContext.Current.Request);
            }
            else
            {
                _Browser = (CurrBrowser)Session["bw"];
            }

            // check for user rights to this page
            if (Session["UserName"] == null)
            {
                usrname = Request.ServerVariables["LOGON_USER"];
                HttpContext.Current.Session["UserName"] = usrname;
            }
            else
            {
                usrname = HttpContext.Current.Session["UserName"].ToString();
            }

            // get user object and put it in the session
            if (_user == null)
            {
                if (HttpContext.Current.Session["CurrentUser"] != null)
                {
                    _user = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
                }
                else
                {
                    _user = new CurrentUser(usrname, logFilePath, "");                     // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
                    HttpContext.Current.Session["CurrentUser"] = _user;
                }
            }
            // Access rule
            if (_user == null || !_user.IsValid)
            {
                string AppLog = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
                Log.WriteLogEntry("User Login failed " + usrname, AppLog);
                Session["NoAccessMsg"] = "You do not have access to forecasting";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            // check for specific rights
            if (!_user.IsInRole("wurthedt") && !_user.IsInRole("datmngtedit") && !_user.IsInRole("datmngtview") && !_user.IsAdmin == true)
            {
                Session["NoAccessMsg"] = "You do not have access to wurth generation.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }
            this._CanEdit = true;
            this._IsAdmin = _user.IsAdmin;
            _CBuildNbr    = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _UserID       = Convert.ToInt32(_user.UserID);
            _LocationCode = _user.LocationCode;

            if (!this.IsPostBack)
            {
                try
                {
                    var _TargetDate = DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek + (int)DayOfWeek.Monday);

                    ViewState.Add("TargetDate", _TargetDate.ToString());
                    ViewState.Add("LocationCode", _LocationCode);
                    ViewState.Add("TargetGrid", _TargetGrid.ToString());
                }
                catch (Exception ex)
                {
                    this._ErrMsg          = "Initial data Load encountered an error: " + ex.Message;
                    this.lblErrorMsg.Text = this._ErrMsg;
                }
            }
            else
            {
                // postback
                _TargetDate   = Convert.ToDateTime(ViewState["TargetDate"]);
                _LocationCode = ViewState["LocationCode"].ToString();
                _TargetGrid   = Convert.ToInt32(ViewState["TargetGrid"]);
            }
            //string jsScript = "";
            //jsScript = "<script type=\"text/javascript\">var jigEmpID=" + _user.EmpID.ToString() + ";var jsgBrowserType='" + _Browser.BrowserType.ToString() + "';var jsgAr=" + _user.AccessRights.ToString() + ";</script>";
            //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariables", jsScript);
        }
Ejemplo n.º 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
            string usrname = "";

            _PgNbr  = 0;
            _PgSize = 20;
            string logFilePath   = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
            string ips           = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
            string CurrSessionID = System.Web.HttpContext.Current.Session.SessionID;

            _Browser = new CurrBrowser(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);
                Session["NoAccessMsg"] = "You do not have access to CAT product pricing";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            // check for specific rights to cat tool
            if (!_user.IsInRole("catAdmin") && !_user.IsInRole("catprcedit") && !_user.IsInRole("catAdmin") && !_user.IsInRole("datamngtcat") && _user.IsAdmin == false)
            {
                Session["NoAccessMsg"] = "You do not have access to the Cat item pricing.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }
            if (_user.ProdAvailRights > 1)
            {
                this._CanEdit = true;
            }
            if (_user.ProdAvailRights > 3)
            {
                this._IsAdmin = true;
            }

            _BuildNbr                = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _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();
            //if (!this.IsPostBack)
            //{
            //	try
            //	{
            //		LoadSpeciesListE();
            //		LoadGradeListE();
            //		LoadThicknessListE();
            //		LoadColorListE();
            //		LoadLengthListE();
            //		LoadMillingListE();
            //		LoadNoPrintListE();
            //		LoadSortListE();
            //		gvRegionPriceTrackLoad();

            //		this.imgSortDir.ImageUrl = "~/Images/arrow2_n.gif";
            //		_SortDir = 0;
            //		ViewState.Add("SortDir", "0");
            //	}
            //	catch (Exception ex)
            //	{
            //		this._ErrMsg = "Initial data Load encountered an error: " + ex.Message;
            //		this.lblErrorMsg.Text = this._ErrMsg;
            //	}

            //	//string jsScript = "";
            //	//jsScript = "<script type=\"text/javascript\">var jigEmpID=" + _user.EmpID.ToString() + ";var jsgBrowserType='" + _Browser.BrowserType.ToString() + "';var jsgAr=" + _user.AccessRights.ToString() + ";</script>";
            //	//Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariables", jsScript);
            //}
            //else
            //{
            //	// postback
            //	_SortDir = Convert.ToInt32(ViewState["SortDir"]);
            //}
            string jsScript = "";

            jsScript = "<script type=\"text/javascript\">var jigEmpID=" + _user.UserID.ToString() + ";var jsgBrowserType='" + _Browser.BrowserType.ToString() + "';var jsgAr=" + _user.AccessRights.ToString() + ";var jgA=" + _IsAdmin.ToString().ToLower() + ";var jsgError ='" + this._ErrMsg + "';var jsgLoc='" + _LocationCode + "';</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariables", jsScript);
        }
Ejemplo n.º 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();

        // initialize variables
        bool   Okay        = true;
        int    Pg          = 0;
        Guid   g           = Guid.Empty;
        string sGUID       = String.Empty;
        string sPG         = String.Empty;
        string redirectUrl = "NoAcc/NoAccess.aspx";
        string UserName    = Request.ServerVariables["LOGON_USER"];

        HttpContext.Current.Session["AssumedEntityLogin"] = string.Empty;
        //lblStatusMsg.Text = UserName;
        System.IO.Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

        if (!String.IsNullOrWhiteSpace(Request["p"]))
        {
            Pg = Convert.ToInt32(Request["p"].ToString());
        }
        else
        {
            Pg = 0;
        }
        if (!string.IsNullOrWhiteSpace(Request["g"]))
        {
            sGUID = new Guid(sGUID).ToString();
        }
        else
        {
            sGUID = Guid.Empty.ToString();
        }
        if (!string.IsNullOrWhiteSpace(sGUID))
        {
        }

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

        //string UserName2 = System.Web.HttpContext.Current.User.Identity.Name;
        //string jsScript = "<script type=\"text/javascript\">alert('" + UserName + "');</script>";
        //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariables", jsScript);
        //Label l = (Label)this.FindControl("Label1");
        //l.Text = UserName;
        //Response.Flush();
        //Response.End();
        //Label l2 = (Label)this.FindControl("Label2");

        //l2.Text = UserName2;
        //throw new Exception("No Way");

        HttpContext.Current.Session["UserName"] = UserName;
        // identify user
        _user = new CurrentUser(UserName, logFilePath, "");
        if (_user == null || !_user.IsValid)
        {
            // write to log
            Logging.WriteToLog("Login failed for " + UserName + ".");
            HttpContext.Current.Session["NoAccessMsg"] = "No valid login record found. You do not have access to the coding application";
            HttpContext.Current.Response.Redirect("NoAcc/NoAccess.aspx", true);
        }
        else
        {
            Session["CurrentUser"] = _user;
            Logging.WriteToLog("Login user object instantiated for " + UserName + ".");
        }

        // establish user authentication objects and identify next page
        try
        {
            FormsAuthenticationTicket authTicket = null;
            FormsAuthentication.Initialize();
            authTicket = new FormsAuthenticationTicket(1, UserName, DateTime.Now, DateTime.Now.AddMinutes(System.Web.HttpContext.Current.Session.Timeout), true, _user.UserID.ToString());
            string encTicket = FormsAuthentication.Encrypt(authTicket);
            System.Web.HttpContext.Current.Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));

            bwsr = (CurrBrowser)Session["bw"];
            string ips = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
            Logging.WriteToLog("Login established for " + UserName + ".");
            GenUtilities.LoadUserSessionData(_user, UserName);
            // log session start
            Commands cmd    = new Commands();
            string   SessID = String.Empty;
            SessID = Session["SessionID"].ToString();
            int iRtn = cmd.LogSessionStart("DataMngt", _user.LoginName, _user.UserID, bwsr.BrowserType, bwsr.BrowserType, ips, "Windows", SessID);
            Session["DataLoaded"] = "0";

            redirectUrl = "~/page/MainMenu.aspx";             // ------------------------------------------------------
        }
        catch (Exception ex)
        {
            //write to log
            Logging.WriteToLog("Data Management Application could not establish authentication forms ticket: " + ex.Message);
            Okay = false;
        }

        // TEMPORARY *******************************************************************
        //Pg = 4;

        //lblStatusMsg.Text = "Initial 3";
        //Response.Flush();
        //Response.End();
        redirectUrl = "page/MainMenu.aspx";

        switch (Pg)
        {
        case 0:                 //menu
            redirectUrl = "page/MainMenu.aspx";
            break;

        case 1:                 // cat tool
            if (_user.IsInRole("catprcedit") || _user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("datmngtview") || _user.IsInRole("datmngtCat") || _user.IsInRole("catview") || _user.IsInRole("catAdmin") || _user.IsInRole("prodavlvw") || _user.IsInRole("prodavlad") || _user.IsInRole("prodavled") || _user.IsInRole("saleslead") || _user.IsAdmin == true)
            {
                redirectUrl = "sales/CatTool.aspx";
            }
            break;

        case 2:
            if (_user.IsInRole("catprcedit") || _user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("datmngtview") || _user.IsAdmin == true)
            {
                redirectUrl = "sales/SalesProducts.aspx";
            }
            break;

        case 3:
            redirectUrl = "page/QueryTool.aspx";
            break;

        case 4:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("datmCustAdm") || _user.IsInRole("datmVendAdm") || _user.IsAdmin == true)
            {
                redirectUrl = "page/EntityList.aspx";
            }
            break;

        case 5:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("forecastview") || _user.IsInRole("forecastadm") || _user.IsInRole("forecastedit") || _user.IsAdmin == true)
            {
                redirectUrl = "prod/ForecastTool.aspx";
            }
            break;

        case 6:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("consoldvw") || _user.IsInRole("consoldv2") || _user.IsAdmin == true)
            {
                redirectUrl = "prod/ForecastConsolidation.aspx";
            }
            break;

        case 7:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("salesplnvw") || _user.IsAdmin == true)
            {
                redirectUrl = "sales/SalesPlan.aspx";
            }
            break;

        case 8:
            redirectUrl = "page/WebCalendar.aspx";
            break;

        case 9:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("wurthedt") || _user.IsInRole("wurthcdadm") || _user.IsInRole("wurthcdedt") || _user.IsInRole("wurthcdvw") || _user.IsAdmin == true)
            {
                redirectUrl = "prod/WurthStyleTag.aspx";
            }
            break;

        case 10:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("wurthcdadm") || _user.IsInRole("wurthcdedt") || _user.IsInRole("wurthcdvw") || _user.IsAdmin == true)
            {
                redirectUrl = "prod/WurthConversion.aspx";
            }
            break;

        case 11:
            if (_user.IsAdmin == true || _user.ClaimsRights > 0)
            {
                redirectUrl = "finance/InvoiceAdj.aspx";
            }
            break;

        case 13:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("sessmngtvw") || _user.IsInRole("sessmngtedt") || _user.IsInRole("sessmngtadm") || _user.IsInRole("procmngtvw") || _user.IsInRole("procmngtedt") || _user.IsInRole("procmngtadm") || _user.IsAdmin == true)
            {
                redirectUrl = "mngt/SessionMngt.aspx";
            }
            break;

        case 14:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("issuemngtvw") || _user.IsInRole("issuemngtedt") || _user.IsInRole("issuemngtadm") || _user.IsAdmin == true)
            {
                redirectUrl = "mngt/IssueMngt.aspx";
            }
            break;

        case 15:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("emailmngtvw") || _user.IsInRole("emailmngtedt") || _user.IsInRole("emailmngtadm") || _user.IsAdmin == true)
            {
                redirectUrl = "mngt/EmailMngt.aspx";
            }
            break;

        case 16:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("procmngtvw") || _user.IsInRole("procmngtedt") || _user.IsInRole("procmngtadm") || _user.IsAdmin == true)
            {
                redirectUrl = "mngt/ProcessManagement.aspx";
            }
            break;

        case 17:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("useredit") || _user.IsInRole("datmUserAdm") || _user.IsInRole("userview") || _user.IsAdmin == true)
            {
                redirectUrl = "mngt/EditUser.aspx";
            }
            break;

        case 18:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("useredit") || _user.IsInRole("datmUserAdm") || _user.IsInRole("userview") || _user.IsAdmin == true)
            {
                redirectUrl = "mngt/EditUserRights.aspx";
            }
            break;

        case 19:
            if (_user.IsInRole("datmngtAdmin") || _user.IsInRole("datmngtedit") || _user.IsInRole("cmtmngtvw") || _user.IsInRole("cmtmngtedt") || _user.IsInRole("cmtmngtadm") || _user.IsInRole("cmtmngtcw") || _user.IsAdmin == true)
            {
                redirectUrl = "page/GenComment.aspx";
            }
            break;

        default:
            break;
        }

        redirectUrl = redirectUrl + "?p=" + Pg.ToString() + "&g=" + sGUID;
        //redirectUrl = "NoAcc/NoAccess.aspx";
        // redirect to next page
        //try
        //{
        //  if (Okay == true)
        //  {
        if (Response.IsClientConnected)
        {
            Response.Redirect(redirectUrl, false);
        }
        else
        {
            //string msg = "";
            Response.Write("You are not connected.");
        }
    }
        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
            //this.divLoadingGif.Style["display"] = "block";
            string usrname = "";

            _PgNbr  = 0;
            _PgSize = 20;
            //this.ddlPageSize.SelectedValue = "20";
            string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();

            // grab browser data
            if (Session["CurrentUser"] == null)
            {
                string ips           = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                string CurrSessionID = System.Web.HttpContext.Current.Session.SessionID;
                _Browser = new CurrBrowser(System.Web.HttpContext.Current.Request);
            }
            else
            {
                _Browser = (CurrBrowser)Session["bw"];
            }

            // check for user rights to this page
            if (Session["UserName"] == null)
            {
                usrname = Request.ServerVariables["LOGON_USER"];
                HttpContext.Current.Session["UserName"] = usrname;
            }
            else
            {
                usrname = HttpContext.Current.Session["UserName"].ToString();
                _user   = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
            }

            // get user object and put it in the session
            if (_user == null)
            {
                if (HttpContext.Current.Session["CurrentUser"] != null)
                {
                    _user = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
                }
                else
                {
                    _user = new CurrentUser(usrname, logFilePath, "");                     // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
                    HttpContext.Current.Session["CurrentUser"] = _user;
                }
            }
            // Access rule
            if (_user == null || !_user.IsValid)
            {
                string AppLog = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
                Log.WriteLogEntry("User Login failed " + usrname, AppLog);
                Session["NoAccessMsg"] = "You do not have access to the check approval application";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            // check for specific rights to cat tool
            if (_user.AccessRights < 2 && _user.CatToolRights == 0)
            {
                Session["NoAccessMsg"] = "You do not have access to the Cat Tool.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            _CBuildNbr = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _UserID    = Convert.ToInt32(_user.UserID);

            // *****************************************************************
            try
            {
                _ProductID  = Request["p"].ToString();
                _TargetDate = Request["d"].ToString();
                _ProdType   = Request["pt"].ToString();
                _TargetDate = Request["d"].ToString();
                _IWeek      = Convert.ToInt32(Request["w"]);
                //_Thickness = Request["t"].ToString();
                //_Species = Request["s"].ToString();
                //_Grade = Request["g"].ToString();
                _Length   = Request["ln"].ToString();
                _Color    = Request["c"].ToString();
                _Sort     = Request["st"].ToString();
                _Milling  = Request["m"].ToString();
                _NoPrint  = Request["np"].ToString();
                _MasterID = Convert.ToInt32(Request["mid"]);
                this.lblProductHdr.Text  = _ProductID;
                this.lblProdTypeHdr.Text = _ProdType;
                this.lblTWeek.Text       = _IWeek.ToString();
                this.lblTDateHdr.Text    = _TargetDate;
                this.lblLengthP.Text     = _Length;
                this.lblColorP.Text      = _Color;
                this.lblSortP.Text       = _Sort;
                this.lblMillingP.Text    = _Milling;
                this.lblNoPrintP.Text    = _NoPrint;
                this.lblMasterID.Text    = _MasterID.ToString();
                if (_Length.Length == 0)
                {
                    this.lblLengthP.Text = "&nbsp;&nbsp;&nbsp;&nbsp;";
                }
                if (_Color.Length == 0)
                {
                    this.lblColorP.Text = "&nbsp;&nbsp;&nbsp;&nbsp;";
                }
                if (_Sort.Length == 0)
                {
                    this.lblSortP.Text = "&nbsp;&nbsp;&nbsp;&nbsp;";
                }
                if (_Milling.Length == 0)
                {
                    this.lblMillingP.Text = "&nbsp;&nbsp;&nbsp;&nbsp;";
                }
                if (_NoPrint.Length == 0)
                {
                    this.lblNoPrintP.Text = "&nbsp;&nbsp;&nbsp;&nbsp;";
                }

                LoadDetailsGrid();
            }
            catch (Exception ex)
            {
                Response.Flush();
                Response.End();
            }
        }
Ejemplo n.º 7
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
            //this.divLoadingGif.Style["display"] = "block";
            this.lblStatusMsg.Text = "";
            string usrname = "";
            //_PgNbr = 0;
            //_PgSize = 20;
            //this.ddlPageSize.SelectedValue = "20";
            string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();

            // grab browser data
            if (Session["CurrentUser"] == null)
            {
                string ips           = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                string CurrSessionID = System.Web.HttpContext.Current.Session.SessionID;
                _Browser = new CurrBrowser(System.Web.HttpContext.Current.Request);
            }
            else
            {
                _Browser = (CurrBrowser)Session["bw"];
            }

            // check for user rights to this page
            if (Session["UserName"] == null)
            {
                usrname = Request.ServerVariables["LOGON_USER"];
                HttpContext.Current.Session["UserName"] = usrname;
            }
            else
            {
                usrname = HttpContext.Current.Session["UserName"].ToString();
                _user   = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
            }

            // get user object and put it in the session
            if (_user == null)
            {
                if (HttpContext.Current.Session["CurrentUser"] != null)
                {
                    _user = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
                }
                else
                {
                    _user = new CurrentUser(usrname, logFilePath, "");                     // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
                    HttpContext.Current.Session["CurrentUser"] = _user;
                }
            }
            // Access rule
            if (_user == null || !_user.IsValid)
            {
                string AppLog = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
                Log.WriteLogEntry("User Login failed " + usrname, AppLog);
                Session["NoAccessMsg"] = "You do not have access to the code maintenance page";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }

            // check for specific rights to cat tool
            if (_user.AccessRights < 2 && _user.CatToolRights == 0)
            {
                Session["NoAccessMsg"] = "You do not have access to the code maintenance page.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }
            if (_user.CatToolRights > 1)
            {
                this._CanEdit = true;
            }
            if (_user.CatToolRights > 3)
            {
                this._IsAdmin = true;
            }

            Commands  cmd = new Commands();
            DataTable dt  = new DataTable();

            _CBuildNbr = System.Configuration.ConfigurationManager.AppSettings["BuildNbr"];
            _UserID    = Convert.ToInt32(_user.UserID);

            if (!this.IsPostBack)
            {
                try
                {
                    _PgNbr  = 0;
                    _PgSize = 20;

                    // load user tracks
                    dt = cmd.SelectUserTracks(_UserID, _PageID, 0);
                    if (dt.Rows.Count > 0)
                    {
                        this.ddlPageSize.SelectedValue = dt.Rows[0]["PgSize"].ToString();
                        _PgNbr  = Convert.ToInt32(dt.Rows[0]["PgNbr"]);
                        _PgSize = Convert.ToInt32(dt.Rows[0]["PgSize"]);
                        this.gvCodeList.PageSize  = _PgSize;
                        this.gvCodeList.PageIndex = _PgNbr;
                    }
                }
                catch (Exception ex)
                {
                    this._ErrMsg           = "Initial data Load encountered an error: " + ex.Message;
                    this.lblStatusMsg.Text = this._ErrMsg;
                }

                BindDataGrid(1);

                ViewState.Add("PgNbr", _PgNbr.ToString());
                ViewState.Add("PgSize", _PgSize.ToString());
                ViewState.Add("NbrPages", _NbrPages.ToString());
            }
            else
            {
                //is postback - SET VIEWSTATE DATA
                _PgNbr    = Convert.ToInt32(ViewState["PgNbr"]);
                _PgSize   = Convert.ToInt32(ViewState["PgSize"]);
                _NbrPages = Convert.ToInt32(ViewState["NbrPages"]);
            }
            //string jsScript = "";
            //jsScript = "<script type=\"text/javascript\">var jigEmpID=" + _user.EmpID.ToString() + ";var jsgBrowserType='" + _Browser.BrowserType.ToString() + "';var jsgAr=" + _user.AccessRights.ToString() + ";</script>";
            //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariables", jsScript);
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string usrname = "";
            //_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;

            // grab browser data
            if (Session["CurrentUser"] == null)
            {
                string ips           = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                string CurrSessionID = System.Web.HttpContext.Current.Session.SessionID;
                _Browser = new CurrBrowser(System.Web.HttpContext.Current.Request);
            }
            else
            {
                _Browser = (CurrBrowser)Session["bw"];
            }

            // check for user rights to this page
            if (Session["UserName"] == null)
            {
                usrname = Request.ServerVariables["LOGON_USER"];
                HttpContext.Current.Session["UserName"] = usrname;
            }
            else
            {
                usrname = HttpContext.Current.Session["UserName"].ToString();
                _user   = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
            }

            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;
            }
            // get user object and put it in the session
            if (_user == null)
            {
                if (HttpContext.Current.Session["CurrentUser"] != null)
                {
                    _user = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
                }
                else
                {
                    _user = new CurrentUser(usrname, logFilePath, AssumedLogin);                     // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
                    HttpContext.Current.Session["CurrentUser"] = _user;
                }
            }
            // Access rule
            if (_user == null || !_user.IsValid)
            {
                string AppLog = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();
                Log.WriteLogEntry("User Login failed " + usrname, AppLog);
                Session["NoAccessMsg"] = "You do not have access to the check approval application";
                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.CatToolRights > 4 || _user.EditCustomers > 4 || _user.EditLocations > 4 || _user.EditUsers > 4 || _user.EditVendors > 4)
            {
                this.divShowAdminStuff.Style["display"] = "inline-table";
            }

            //Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = QuitApplication();");
            string jsScript = "";

            jsScript = "<script type=\"text/javascript\">var jigEmpID=" + _user.UserID.ToString() + ";var jsgCBBrowserType='" + _Browser.BrowserType.ToString() + "';var jsgCBAssumd=" + IsAssumed.ToString() + ";var jgCBA=" + _user.IsAdmin.ToString().ToLower() + ";</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyTargetVariablesCB", jsScript);
        }
Ejemplo n.º 9
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
            string s       = string.Empty;
            string s2      = string.Empty;
            string s3      = string.Empty;
            string usrname = string.Empty;

            //_PgNbr = 0;
            _PgSize = 20;
            string logFilePath = System.Configuration.ConfigurationManager.AppSettings["AppLogFilePath"].ToString();

            // grab browser data
            if (Session["CurrentUser"] == null)
            {
                string ips           = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                string CurrSessionID = System.Web.HttpContext.Current.Session.SessionID;
                _Browser = new CurrBrowser(System.Web.HttpContext.Current.Request);
            }
            else
            {
                _Browser = (CurrBrowser)Session["bw"];
            }

            // check for user rights to this page
            if (Session["UserName"] == null)
            {
                usrname = Request.ServerVariables["LOGON_USER"];
                HttpContext.Current.Session["UserName"] = usrname;
            }
            else
            {
                usrname = HttpContext.Current.Session["UserName"].ToString();
            }

            // get user object and put it in the session
            if (_user == null)
            {
                if (HttpContext.Current.Session["CurrentUser"] != null)
                {
                    _user = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
                }
                else
                {
                    _user = new CurrentUser(usrname, logFilePath, "");                     // SessionHelper.GetCurrentUser(Request.ServerVariables["LOGON_USER"]);
                    HttpContext.Current.Session["CurrentUser"] = _user;
                }
            }

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

            // check for specific rights
            if (!_user.IsInRole("wurthedt") && !_user.IsInRole("datmngtedit") && !_user.IsInRole("datmngtview") && !_user.IsAdmin == true && !_user.IsInRole("forecastedit"))
            {
                Session["NoAccessMsg"] = "You do not have access to wurth generation.";
                Response.Redirect("../NoAcc/NoAccess.aspx", true);
            }
            this._CanEdit = true;
            this._IsAdmin = _user.IsAdmin;
            _UserID       = _user.UserID;
            int NbrItems = 0;

            //string inbr = "var jogItemNbr=[[i1],[i2],[i3],[i4],[i5],[i6],[i7],[i8],[i9],[i10],[i11],[i12],[i13],[i14],[i15],[i16],[i17],[i18],[i19],[i20]];";
            //string pobr = "var jogPONbr=[[i1],[i2],[i3],[i4],[i5],[i6],[i7],[i8],[i9],[i10],[i11],[i12],[i13],[i14],[i15],[i16],[i17],[i18],[i19],[i20]];";
            //string ft = "var jogFootage=[[i1],[i2],[i3],[i4],[i5],[i6],[i7],[i8],[i9],[i10],[i11],[i12],[i13],[i14],[i15],[i16],[i17],[i18],[i19],[i20]];";
            //string len = "var jogLen=[[i1],[i2],[i3],[i4],[i5],[i6],[i7],[i8],[i9],[i10],[i11],[i12],[i13],[i14],[i15],[i16],[i17],[i18],[i19],[i20]];";

            if (!this.IsPostBack)
            {
                try
                {
                    string CustAddr    = string.Empty;
                    string CustCity    = string.Empty;
                    string CustCountry = string.Empty;
                    string CustName    = string.Empty;
                    string CustPO      = string.Empty;
                    string CustSt      = string.Empty;
                    string CustZip     = string.Empty;
                    string ItemNbr     = string.Empty;
                    double Fig         = 0;
                    _Page      = Convert.ToInt32(Request["p"]);
                    _OrdNbr    = Convert.ToInt32(Request["o"]);
                    _WurthOnly = Convert.ToInt32(Request["w"]);
                    if (_OrdNbr > 0)
                    {
                        // Load Order and associated data
                        //Commands cmd = new Commands();
                        //DataTable dt0 = cmd.SelectOrderNbrData(_OrdNbr, _UserID);
                        //if (dt0.Rows.Count > 0)
                        //{
                        //	CustName = dt0.Rows[0]["CustName"].ToString();
                        //	CustAddr = dt0.Rows[0]["CustAddress"].ToString();
                        //	CustCity = dt0.Rows[0]["CustCity"].ToString();
                        //	CustCountry = dt0.Rows[0]["Country"].ToString();
                        //	CustSt = dt0.Rows[0]["StProv"].ToString();
                        //	CustZip = dt0.Rows[0]["Zip"].ToString();
                        //	CustPO = dt0.Rows[0]["CustPO"].ToString();
                        //}

                        // populate page objects
                        DataRow dr;
                        //DataTable dt = cmd.SelectOrderItemData(_OrdNbr, 1, (_Page + 1), _UserID);
                        SalesFunctions sf = new SalesFunctions();
                        DataTable      dt = sf.SelectLTWurthProductData(_OrdNbr, (_Page + 1), _WurthOnly, _UserID);
                        NbrItems = dt.Rows.Count;
                        if (NbrItems > 0)
                        {
                            for (int rowz = 0; rowz < 20; rowz++)
                            {
                                if (rowz < NbrItems)
                                {
                                    dr      = dt.Rows[rowz];
                                    ItemNbr = "0";
                                    Label lbl = new Label();
                                    // if more than one item, show print area (half page each)
                                    if (rowz == 1)
                                    {
                                        this.divOrderItem1.Style["display"] = "block";
                                    }
                                    if (rowz == 2)
                                    {
                                        this.divOrderItem2.Style["display"] = "block";
                                    }
                                    if (rowz == 3)
                                    {
                                        this.divOrderItem3.Style["display"] = "block";
                                    }
                                    if (rowz == 4)
                                    {
                                        this.divOrderItem4.Style["display"] = "block";
                                    }
                                    if (rowz == 5)
                                    {
                                        this.divOrderItem5.Style["display"] = "block";
                                    }
                                    if (rowz == 6)
                                    {
                                        this.divOrderItem6.Style["display"] = "block";
                                    }
                                    if (rowz == 7)
                                    {
                                        this.divOrderItem7.Style["display"] = "block";
                                    }
                                    if (rowz == 8)
                                    {
                                        this.divOrderItem8.Style["display"] = "block";
                                    }
                                    if (rowz == 9)
                                    {
                                        this.divOrderItem9.Style["display"] = "block";
                                    }
                                    if (rowz == 10)
                                    {
                                        this.divOrderItem10.Style["display"] = "block";
                                    }
                                    if (rowz == 11)
                                    {
                                        this.divOrderItem11.Style["display"] = "block";
                                    }
                                    if (rowz == 12)
                                    {
                                        this.divOrderItem12.Style["display"] = "block";
                                    }
                                    if (rowz == 13)
                                    {
                                        this.divOrderItem13.Style["display"] = "block";
                                    }
                                    if (rowz == 14)
                                    {
                                        this.divOrderItem14.Style["display"] = "block";
                                    }
                                    if (rowz == 15)
                                    {
                                        this.divOrderItem15.Style["display"] = "block";
                                    }
                                    if (rowz == 16)
                                    {
                                        this.divOrderItem16.Style["display"] = "block";
                                    }
                                    if (rowz == 17)
                                    {
                                        this.divOrderItem17.Style["display"] = "block";
                                    }
                                    if (rowz == 18)
                                    {
                                        this.divOrderItem18.Style["display"] = "block";
                                    }
                                    if (rowz == 19)
                                    {
                                        this.divOrderItem19.Style["display"] = "block";
                                    }
                                    // fill in associated data for print area
                                    lbl = (Label)this.FindControl("lblMainTagHeader" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = dr["CustName"].ToString();
                                    }
                                    lbl = (Label)this.FindControl("lblTagHdrAddress" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = dr["CustAddress"].ToString();
                                    }
                                    lbl = (Label)this.FindControl("lblTagHdrCityStZip" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = dr["CustCity"].ToString() + " " + dr["StProv"].ToString() + " " + dr["Zip"].ToString();
                                    }
                                    lbl = (Label)this.FindControl("lblTagHdrCountry" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = dr["Country"].ToString();
                                    }
                                    lbl = (Label)this.FindControl("lblOrderNbr" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = _OrdNbr.ToString();
                                    }
                                    lbl = (Label)this.FindControl("lblShipDate" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = dr["sShipDate"].ToString();
                                    }

                                    lbl     = (Label)this.FindControl("lblItemNbr" + rowz.ToString());
                                    ItemNbr = dr["WurthCode"].ToString().ToUpper();
                                    if (lbl != null)
                                    {
                                        lbl.Text = ItemNbr;
                                    }
                                    lbl = (Label)this.FindControl("lblItemNbrBarCode" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = ItemNbr;
                                    }

                                    lbl = (Label)this.FindControl("lblPONbrBarCode" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = dr["CustPO"].ToString();
                                    }
                                    lbl = (Label)this.FindControl("lblFootageBarCode" + rowz.ToString());
                                    Fig = Convert.ToDouble(dr["WWGVol"]) * 1000;
                                    if (lbl != null)
                                    {
                                        lbl.Text = Fig.ToString();
                                    }
                                    lbl = (Label)this.FindControl("lblLengthBarCode" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = dr["iProdLen"].ToString();
                                    }
                                    lbl = (Label)this.FindControl("lblPackage" + rowz.ToString());
                                    s   = dt.Rows[0]["ProdWidth"].ToString();
                                    if (s == null)
                                    {
                                        s = "";
                                    }
                                    s2 = dt.Rows[0]["iProdLen"].ToString();
                                    if (s2 == null)
                                    {
                                        s2 = "";
                                    }
                                    s3 = dt.Rows[0]["PkgHeight"].ToString();
                                    if (s3 == "")
                                    {
                                        s3 = "0";
                                    }
                                    if (lbl != null)
                                    {
                                        lbl.Text = s3 + "x" + s + "x" + s2;
                                    }
                                    lbl = (Label)this.FindControl("lblUnitNbrValue" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = dr["WurthCode"].ToString();
                                    }
                                    lbl = (Label)this.FindControl("lblUnitNbrValue" + rowz.ToString());
                                    if (lbl != null)
                                    {
                                        lbl.Text = dr["TagNbr"].ToString();
                                    }
                                }
                                else
                                {
                                    if (rowz == 1)
                                    {
                                        this.divOrderItem1.Style["display"] = "none";
                                    }
                                    if (rowz == 2)
                                    {
                                        this.divOrderItem2.Style["display"] = "none";
                                    }
                                    if (rowz == 3)
                                    {
                                        this.divOrderItem3.Style["display"] = "none";
                                    }
                                    if (rowz == 4)
                                    {
                                        this.divOrderItem4.Style["display"] = "none";
                                    }
                                    if (rowz == 5)
                                    {
                                        this.divOrderItem5.Style["display"] = "none";
                                    }
                                    if (rowz == 6)
                                    {
                                        this.divOrderItem6.Style["display"] = "none";
                                    }
                                    if (rowz == 7)
                                    {
                                        this.divOrderItem7.Style["display"] = "none";
                                    }
                                    if (rowz == 8)
                                    {
                                        this.divOrderItem8.Style["display"] = "none";
                                    }
                                    if (rowz == 9)
                                    {
                                        this.divOrderItem9.Style["display"] = "none";
                                    }
                                    if (rowz == 10)
                                    {
                                        this.divOrderItem10.Style["display"] = "none";
                                    }
                                    if (rowz == 11)
                                    {
                                        this.divOrderItem11.Style["display"] = "none";
                                    }
                                    if (rowz == 12)
                                    {
                                        this.divOrderItem12.Style["display"] = "none";
                                    }
                                    if (rowz == 13)
                                    {
                                        this.divOrderItem13.Style["display"] = "none";
                                    }
                                    if (rowz == 14)
                                    {
                                        this.divOrderItem14.Style["display"] = "none";
                                    }
                                    if (rowz == 15)
                                    {
                                        this.divOrderItem15.Style["display"] = "none";
                                    }
                                    if (rowz == 16)
                                    {
                                        this.divOrderItem16.Style["display"] = "none";
                                    }
                                    if (rowz == 17)
                                    {
                                        this.divOrderItem17.Style["display"] = "none";
                                    }
                                    if (rowz == 18)
                                    {
                                        this.divOrderItem18.Style["display"] = "none";
                                    }
                                    if (rowz == 19)
                                    {
                                        this.divOrderItem19.Style["display"] = "none";
                                    }
                                }
                            }                     //or (int rowz = 0; rowz < 20; rowz++)
                        }                         //NbrItems > 0
                        else
                        {
                            divErrorMsg.Style["display"] = "block";
                            lblErrorMsg.Text             = "No items were found for that order number.";
                        }
                    }
                    else
                    {
                        divErrorMsg.Style["display"] = "block";
                        lblErrorMsg.Text             = "Invalid order number.";
                    }
                }
                catch (Exception ex)
                {
                    this._ErrMsg          = "Could not generate Wurth-Style tags. Initial data Load encountered an error: " + ex.Message;
                    this.lblErrorMsg.Text = this._ErrMsg;
                }
            }
            string jsScript = "<script type=\"text/javascript\">var jgNItems=" + NbrItems.ToString() + ";</script>";

            //window.print(); window.onfocus = function() { window.close();
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PrintThisForm", jsScript);
        }