Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string searchPageCookieURL = _appFriendlyName + @"/SearchPage";

            searchPageCookies = new SQLCookies(searchPageCookieURL, userID, SecCred);

            setUpDictionary();

            if (!IsPostBack)
            {
                ViewState["SortExpression"] = "WFID ASC";

                // Use Sort stored in cookies
                if (!string.IsNullOrEmpty(myCook.GetCookieSQL("SearchResultsSortField")))
                {
                    ViewState["SortExpression"] = myCook.GetCookieSQL("SearchResultsSortField") + " " + myCook.GetCookieSQL("SearchResultsSortOrder");
                }

                initData(false);
            }

            if (Request["__EVENTTARGET"] == "DownloadToExcel")
            {
                ExportTableExcel();
            }

            ConfigurePage();
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            searchPageCookies = new SQLCookies(_appFriendlyName + @"/SearchPage", userID, SecCred);

            ddl_Location.Attributes.Add("onchange", "fnLocationChanged()");

            if (!IsPostBack)
            {
                initForm();

                string allCookies = searchPageCookies.getCookieString();
                allCookies = allCookies.Replace(";", "&");
                prePopulateForm(allCookies);
            }

            if (Request["__EVENTTARGET"] == "Search")
            {
                string s = buildQuery();
                Response.Redirect("searchresults.aspx?" + s);
            }

            if (Request["__EVENTTARGET"] == "ClearForm")
            {
                ClearForm();
            }

            if (Request["__EVENTTARGET"] == "New")
            {
                NewWF();
            }

            //if (Request["__EVENTTARGET"] == "MyWorkfow")
            //{
            //    string s = buildQuery(true);
            //    Response.Redirect("searchresults.aspx?" + s);
            //}

            ConfigurePage();
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TheCookies = new SQLCookies(URL, userID, SecCred);

            if ((_isOwner || _isAdmin) && _DBStatus == Routing2.DBStatus.NotStarted)
            {
                _editRequest = true;
            }

            //imgBtn_GetEquipment.ImageUrl = "images/new add16.png";
            //imgBtn_GetEquipment.Attributes.Add("onclick", "fnGetEquipment(); return false;");

            ddl_Department.Attributes.Add("onchange", "fnDeptChanged();");

            queryString = "BP=" + _BP + "&WorkFlowID=" + workflowID;
            if (Request["returnToList"] != null)
            {
                queryString += "&returnToList=" + Request["returnToList"];
            }

            if (!IsPostBack)
            {
                initForm();

                if (Request["ResetWorkflow"] != null)
                {
                    workflow2.ResetWorkflow((int)myHeaderDT.Rows[0]["WFID"]);
                    tools.DeleteTimeWorked(myHeaderDT.Rows[0]["ID"].ToString());
                    Response.Redirect("mainForm.aspx?" + queryString);
                }

                GetRequestHeaderData();
            }

            if (Request["__EVENTTARGET"] == "Department")
            {
                initEquipment();
            }

            if (Request["__EVENTTARGET"] == "Delete")
            {
                if (int.Parse(workflowID) > 0)
                {
                    workflow2.DeleteWorkflowHeader(int.Parse(workflowID));
                }
                tools.deleteHeader(workflowID);

                DataTable dt = tools.getHeader(workflowID, true);
                if (dt.Rows.Count > 0)
                {
                    Response.Redirect("mainForm.aspx?BP=" + _BP + "&WorkflowID=" + dt.Rows[dt.Rows.Count - 1]["WFID"].ToString());
                }

                Response.Redirect("default.aspx?BP=" + _BP);
            }

            if (Request["__EVENTTARGET"] == "CopyWF")
            {
                fnCopyTemplateToWorkflow(Request["__EVENTARGUMENT"], ddlWorkflowTemplates.SelectedItem.Text);
            }

            if (Request["__EVENTTARGET"] == "newUser")
            {
                newUser();
            }

            getTemplateList();

            if (Request["__EVENTTARGET"] == "newEquipment")
            {
                if (ddl_Equipment.Items.FindByValue(Request["__EVENTARGUMENT"]) == null)
                {
                    ddl_Equipment.Items.Add(new ListItem(Request["__EVENTARGUMENT"], Request["__EVENTARGUMENT"]));
                    ddl_Equipment.SelectedValue = Request["__EVENTARGUMENT"];
                }
            }

            if (Request["__EVENTTARGET"] == "Submit")
            {
                StartRequest();
            }

            if (Request["__EVENTTARGET"] == "CancelWF")
            {
                workflow2.CancelWorkflow(int.Parse(workflowID), Request["__EVENTARGUMENT"] + "");

                string stepEmail = workflow2.fnGetAllStepUsersEmail(int.Parse(workflowID));
                workflow2.SendEmail(int.Parse(workflowID), 0, userEmail, stepEmail, Request["__EVENTARGUMENT"] + "");
                Response.Redirect("mainForm.aspx?" + Request.QueryString);
            }

            //if (Request["__EVENTTARGET"] == "Save")
            //{
            //    bool retval = SaveRequest();
            //    if (retval)
            //        Response.Redirect("mainForm.aspx?" + queryString);
            //}

            //' //************ INSERT USER CONTROL/SUPPORT FOR ROUTING STEPS *******************/
            uctemplate = (WF.WorkflowSteps2)LoadControl("~/workflow/WorkflowSteps2.ascx");
            WorkflowStepDisplay.Controls.Add(uctemplate);
            uctemplate.workflowMessage += messageFromWorkflow;

            if (Request["__EVENTTARGET"] == "DeleteAttachment")
            {
                if (Request["__EVENTARGUMENT"] != null)
                {
                    tools.deleteAttachment(Request["__EVENTARGUMENT"]);
                }
            }

            if (Request["__EVENTTARGET"] == "AddAttachment")
            {
                addAttachment();
            }

            initAttachments();

            initTimeWorked();

            addPopUpToolbar_User();

            ConfigurePage();
        }
Exemplo n.º 5
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);
        }