Пример #1
0
        protected override void OnInit(EventArgs e)
        {
            //_debug = true;

            SecCred = new SecurityCredentials();

            if (System.Configuration.ConfigurationManager.AppSettings["usesAD"] != null)
            {
                _usesAD = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["usesAD"]);
            }

            AU = new Authentication(SecCred, _usesAD);

            if (_usesAD)
            {
                WSSecurity = new WebSecure(Response, Request, Session);
                userID     = WSSecurity.AuthenticateUser();
                if (userID.Length > 0)
                {
                    Profile p = AU.GetUserProfile(userID);
                    userFriendlyName = p.friendlyName;
                    userEmail        = p.email;
                }
            }
            else
            {
                userID = AU.getPortalCookie(Request, Response);
                if (userID.Length == 0)
                {
                    if (!Request.ServerVariables["PATH_INFO"].Contains("Login"))
                    {
                        Response.Redirect("Login/default.aspx");
                    }
                }
            }

            _webServer           = this.Request.Url.Authority;
            _webConfig_WebServer = System.Configuration.ConfigurationManager.AppSettings["WebServer"];
            _appPath             = Request.ApplicationPath;

            _BP = Request["BP"] + "";
            if (_BP == "")
            {
                _BP = "1100";
            }

            workflowID = Request["workflowID"] + "";
            if (workflowID.Length == 0 || workflowID == "-1")
            {
                workflowID = "0";
            }

            _stepID     = Request["stepID"];
            _stepUserID = Request["stepUserID"] + "";

            _dbName          = System.Configuration.ConfigurationManager.AppSettings["dbName"];
            _appFriendlyName = System.Configuration.ConfigurationManager.AppSettings["AppFriendlyName"];

            tools = new Tools2(_BP, userID, SecCred, _usesAD);

            _culture            = UserCulture();
            _nfi                = (NumberFormatInfo)_culture.NumberFormat.Clone();
            _nfi.CurrencySymbol = "$";

            string       filename = Server.MapPath("~/CSS/osx2_1.css");
            StreamReader sr       = File.OpenText(filename);
            string       s        = sr.ReadToEnd();

            workflow2 = new Workflow2(SecCred, _BP, userID, _culture, s, 700, _usesAD);


            dbServerModeStruct sms = SecCred.GetServerMode(Request.Url.Host);

            _ServerModeOptions = sms.Options;

            if (System.Configuration.ConfigurationManager.AppSettings["RoutingDebugStatus"] != null && sms.Mode != "P")
            {
                workflow2.debug      = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["RoutingDebugStatus"]);
                workflow2.debugUsers = System.Configuration.ConfigurationManager.AppSettings["RoutingDebugEmail"];
            }

            _DBStatus = Routing2.DBStatus.NotStarted;

            myHeaderDT = tools.getHeader(workflowID, false);
            if (myHeaderDT.Rows.Count > 0)
            {
                if (myHeaderDT.Rows[0]["BP"].ToString() != _BP)
                {
                    _BP = myHeaderDT.Rows[0]["BP"].ToString();
                }

                tools.BP      = _BP;
                workflow2._BP = _BP;

                _isOwner  = tools.IsOwner(workflowID);
                _DBStatus = workflow2.WorkflowStatusEnum((int)myHeaderDT.Rows[0]["Status"]);
            }

            PageTitle = _appFriendlyName;

            _isAdmin = tools.isAdmin(_BP);

            //if (Request["Edit"] + "" == "1" || Request["Edit"] + "" == "True" && (_isOwner || _isAdmin))// _hasModifyRights)
            //  _editRequest = true;

            myCook = new SQLCookies(_appFriendlyName, userID, SecCred);

            sqlConn = new SqlConnection();
            sqlConn.ConnectionString = SecCred.ConnectionStringSQL(_dbName);

            base.OnInit(e);
        }
Пример #2
0
        public BaseClassWF(HttpRequest Request, WebSecure WSSecurity, HttpServerUtility httpServer, HttpResponse Response)
        {
            SecCred = new SecurityCredentials();

            if (System.Configuration.ConfigurationManager.AppSettings["usesAD"] != null)
            {
                _usesAD = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["usesAD"]);
            }

            AU = new Authentication(SecCred, _usesAD);

            if (_usesAD)
            {
                _WSSecurity = WSSecurity;
                _userID     = _WSSecurity.AuthenticateUser();
            }
            else
            {
                _userID = AU.getPortalCookie(Request, Response);
            }

            Server = httpServer;

            _webServer        = Request.Url.Authority;
            SecCred.WebServer = _webServer;

            _BP = Request["BP"];

            _stepID = Request["stepID"];
            if (Request["mailMessage"] != null)
            {
                _isMailMessage = true;
            }

            _appFriendlyName = System.Configuration.ConfigurationManager.AppSettings["AppFriendlyName"];
            _databaseName    = System.Configuration.ConfigurationManager.AppSettings["dbName"];
            //tools = new Tools2(_BP, userID, SecCred, _usesAD);

            culture = new CultureInfo("en-US");
            try
            {
                if (Request.UserLanguages != null)
                {
                    culture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
                }
            }
            catch
            { }

            _appPath    = Request.ApplicationPath;
            _workflowID = Request["workflowID"] + "";
            if (_workflowID.Length == 0 || _workflowID == "-1")
            {
                _workflowID = "0";
            }

            string       filename = Server.MapPath("~/CSS/osx2_1.css");
            StreamReader sr       = File.OpenText(filename);
            string       s        = sr.ReadToEnd();

            workflow2 = new Workflow2(SecCred, _BP, _userID, culture, s, 700, _usesAD);

            dbServerModeStruct sms = SecCred.GetServerMode(Request.Url.Host);

            if (System.Configuration.ConfigurationManager.AppSettings["RoutingDebugStatus"] != null && sms.Mode != "P")
            {
                workflow2.debug      = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["RoutingDebugStatus"]);
                workflow2.debugUsers = System.Configuration.ConfigurationManager.AppSettings["RoutingDebugEmail"] + "";
                //if (!_webServer.Contains("localhost"))
                //  workflow2.debugEmailCopyCreator = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["RoutingDebugEmailCopyCreator"]);
            }

            _isAdmin = workflow2.isAdmin();

            _DBStatus = workflow2.WorkflowStatus(int.Parse(_workflowID));

            switch (_DBStatus)
            {
            case Routing2.DBStatus.Circulating:
            case Routing2.DBStatus.NotStarted:
            case Routing2.DBStatus.Rejected:
                if ((_isAdmin || workflow2.enablePopUpMenus(int.Parse(_workflowID))) && !_isMailMessage)
                {
                    _enableTemplateMenu = true;
                    _enableStepMenu     = true;
                }
                break;
            }

            if (_DBStatus == Routing2.DBStatus.Circulating || _DBStatus == Routing2.DBStatus.Rejected)
            {
                _isSignOffVisible = true;
            }

            //myTranslation = new AppTranslations();
            LangCookies = new SQLCookies("Language", _userID, SecCred);
        }