Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        applicationName = Request.ApplicationPath.TrimEnd('/');
        pageUrl         = SharedFunctions.GetWebMethodPath(Request.Path);
        apiKey          = SharedFunctions.GetMapApiKey(new PX.Data.PXGraph());

        DateTime?startDateBridge;
        var      date = PXContext.GetBusinessDate();

        startDateBridge = (date != null) ? date : PXTimeZoneInfo.Now;

        // Date
        try
        {
            if (!String.IsNullOrEmpty(Request.QueryString["Date"]))
            {
                startDateBridge = Convert.ToDateTime(Request.QueryString["Date"]);
            }
        }
        catch (Exception)
        {
        }

        startDate = ((DateTime)startDateBridge).ToString("MM/dd/yyyy h:mm:ss tt", new CultureInfo("en-US"));

        // Route Information
        StreamReader streamReader = new StreamReader(Server.MapPath("../../Shared/templates/InfoEmployeeRoute.html"));

        infoRoute = streamReader.ReadToEnd();
        streamReader.Close();
    }
Esempio n. 2
0
        public void SaveCurrentContextValues(string companyName, object parentLongOperationKey)
        {
            this._parentFinished         = false;
            this._parentLongOperationKey = parentLongOperationKey;

            this.CompanyName           = companyName;
            this.UserNameForLoginScope = PXDatabase.Companies.Length > 0 ? PXAccess.GetUserName() + "@" + this.CompanyName : PXAccess.GetUserName();

            this.BranchID     = PXContext.GetBranchID();
            this.BusinessDate = PXContext.GetBusinessDate();
            this.ScreenID     = PXContext.GetScreenID();
        }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        applicationName = Request.ApplicationPath.TrimEnd('/');
        pageUrl         = SharedFunctions.GetWebMethodPath(Request.Path);

        DateTime?startDateBridge;
        var      date = PXContext.GetBusinessDate();

        startDateBridge = (date != null) ? date : PXTimeZoneInfo.Now;

        // Date
        try
        {
            if (!String.IsNullOrEmpty(Request.QueryString["Date"]))
            {
                startDateBridge = Convert.ToDateTime(Request.QueryString["Date"]);
            }
        }
        catch (Exception)
        {
        }

        startDate = ((DateTime)startDateBridge).ToString("MM/dd/yyyy h:mm:ss tt", new CultureInfo("en-US"));

        // Filter By RefNbr
        RefNbr = Request.QueryString["RefNbr"];

        // External CustomerID
        CustomerID = Request.QueryString["CustomerID"];

        // External SMEquipmentID
        SMEquipmentID = Request.QueryString["SMEquipmentID"];

        // Focus unassigned Appointment Tab
        AppSource = Request.QueryString["AppSource"];

        // Load Appointment's Body to be used in index.aspx
        StreamReader streamReader = new StreamReader(Server.MapPath("../../Shared/templates/EventTemplate.html"));

        appointmentBodyTemplate = streamReader.ReadToEnd();
        streamReader.Close();

        // Load Appointment's ToolTip to be used in index.aspx
        streamReader = new StreamReader(Server.MapPath("../../Shared/templates/TooltipAppointment.html"));
        toolTipTemplateAppointment = streamReader.ReadToEnd();
        streamReader.Close();

        // Load Service Order's ToolTip to be used in index.aspx
        streamReader = new StreamReader(Server.MapPath("../../Shared/templates/TooltipServiceOrder.html"));
        toolTipTemplateServiceOrder = streamReader.ReadToEnd();
        streamReader.Close();
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        applicationName = Request.ApplicationPath.TrimEnd('/');
        pageUrl         = SharedFunctions.GetWebMethodPath(Request.Path);

        DateTime?startDateBridge;
        var      date = PXContext.GetBusinessDate();

        startDateBridge = (date != null) ? date : PXTimeZoneInfo.Now;

        // Filter By RefNbr
        RefNbr = Request.QueryString["RefNbr"];

        // Employee
        ExternalEmployee = Request.QueryString["bAccountID"];

        // Date
        string   externalDate = Request.QueryString["Date"];
        DateTime currentDate;

        if (!string.IsNullOrEmpty(externalDate))
        {
            currentDate     = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local).AddMilliseconds(Double.Parse(externalDate));
            startDateBridge = currentDate;
        }

        startDate = ((DateTime)startDateBridge).ToString("MM/dd/yyyy h:mm:ss tt", new CultureInfo("en-US"));

        var graphExternalControls = PXGraph.CreateInstance <ExternalControls>();
        var results = graphExternalControls.EmployeeSelected.Select();

        PXResult <EPEmployee, Contact> result = (PXResult <EPEmployee, Contact>)results;

        EPEmployee epEmployeeRow = result;

        if (epEmployeeRow != null)
        {
            DefaultEmployee = epEmployeeRow.BAccountID.ToString();
        }

        if (string.IsNullOrEmpty(ExternalEmployee) && epEmployeeRow != null)
        {
            ExternalEmployee = DefaultEmployee;
        }

        //Load Availability Event Body Template
        StreamReader streamReader = new StreamReader(Server.MapPath("../../Shared/templates/AvailabilityEventTemplate.html"));

        eventBodyTemplate = streamReader.ReadToEnd();
        streamReader.Close();
    }
Esempio n. 5
0
    //---------------------------------------------------------------------------
    /// <summary>
    /// The page Init event handler.
    /// </summary>
    protected void Page_Init(object sender, EventArgs e)
    {
        var lifetimeScope = this.Context.GetLifetimeScope();

        if (lifetimeScope != null)
        {
            screenRepository = lifetimeScope.Resolve <IScreenRepository>();
        }
        else
        {
            var serviceLocator = ServiceLocator.Current;
            screenRepository = serviceLocator.GetInstance <IScreenRepository>();
        }
        JSManager.RegisterModule(new MSScriptRenderer(Page.ClientScript), typeof(AppJS), AppJS.PageTitle);

        if (screenID == null)
        {
            this.screenID = ControlHelper.GetScreenID();
        }
        if (screenTitle == null)
        {
            if (System.Web.SiteMap.CurrentNode != null)
            {
                if (company == null || System.Web.SiteMap.CurrentNode.ParentNode != null)
                {
                    screenTitle = PXSiteMap.CurrentNode.Title;
                }
                else
                {
                    screenTitle = company;
                }
            }
        }

        string hide = this.Page.Request.QueryString[PXUrl.HidePageTitle];

        if (!string.IsNullOrEmpty(hide))
        {
            this.Visible = false; return;
        }

        this.Page.InitComplete += new EventHandler(Page_InitComplete);
        PXCallbackManager.GetInstance().PreGetCallbackResult += PreGetCallbackResult;

        tlbPath.Items["syncTOC"].Visible = false;
        tlbPath.Items["branch"].Visible  = false;
        if (!this.Page.IsCallback)
        {
            ((WebControl)LabelScreen.Parent).CssClass = "pageTitleCont";
        }

        if (PXDataSource.RedirectHelper.IsPopupPage(Page))
        {
            if (!PXList.Provider.HasList(PXSiteMap.CurrentNode.ScreenID))
            {
                tlbPath.Items["syncTOC"].Visible = false;
            }
            this.FavoriteAvailable = false;
            if (!PXDataSource.RedirectHelper.IsPopupInline(Page))
            {
                GetBranchCombo().Enabled = false;
            }
        }

        if (PXSiteMap.IsPortal)
        {
            this.CustomizationAvailable = PXAccess.GetAdministratorRoles().Any(System.Web.Security.Roles.IsUserInRole);
            this.BranchAvailable        = false;
            this.FavoriteAvailable      = false;
            pnlTBR.CssClass             = "panelTBRSP";
        }

        if (PXContext.PXIdentity.Authenticated)
        {
            userName = PXContext.PXIdentity.IdentityName;
            string branch = PXAccess.GetBranchCD();
            if (!string.IsNullOrEmpty(branch))
            {
                userName += ":" + branch;
            }
        }

        var date = PXContext.GetBusinessDate();

        if (date != null)
        {
            PXDateTimeEdit.SetDefaultDate((DateTime)date);
        }

        if (!Page.IsCallback)
        {
            Session.Remove("StoredSearch");
        }

        Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "jq", VirtualPathUtility.ToAbsolute("~/Scripts/jquery-3.1.1.min.js"));
        Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "jqsr", VirtualPathUtility.ToAbsolute("~/Scripts/jquery.signalR-2.2.1.min.js"));
        Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "hb", VirtualPathUtility.ToAbsolute("~/signalr/hubs"));
    }
Esempio n. 6
0
    //---------------------------------------------------------------------------
    /// <summary>
    /// The page Init event handler.
    /// </summary>
    protected void Page_Init(object sender, EventArgs e)
    {
        this.Page.InitComplete += new EventHandler(Page_InitComplete);

        if (PXDataSource.RedirectHelper.IsPopupPage(Page))
        {
            tlbPath.Items["syncTOC"].Visible   = false;
            tlbPath.Items["favorites"].Visible = false;
            tlbPath.Items["branch"].Visible    = false;
        }

        if (PXSiteMap.IsPortal)
        {
            tlbPath.Items["branch"].Visible    = false;
            tlbPath.Items["favorites"].Visible = false;
            pnlTitle.CssClass = "pageTitleSP";
            pnlTBR.CssClass   = "panelTBRSP";
            tlbTools.Items["help"].CssClass = "toolsBtnSP";

            HtmlAnchor label = tlbPath.FindControl("lblScreenTitle") as HtmlAnchor;
            if (label != null)
            {
                label.Attributes["class"] = "linkTitleSP";
            }
        }
        JSManager.RegisterModule(new MSScriptRenderer(Page.ClientScript), typeof(AppJS), AppJS.PageTitle);

        if (PXContext.PXIdentity.Authenticated)
        {
            userName = PXContext.PXIdentity.IdentityName;
            string branch = PXAccess.GetBranchCD();
            if (!string.IsNullOrEmpty(branch))
            {
                userName += ":" + branch;
            }
        }

        if (screenID == null && screenTitle == null)
        {
            this.screenID = ControlHelper.GetScreenID();
            PX.Common.PXContext.SetScreenID(screenID);

            if (System.Web.SiteMap.CurrentNode != null)
            {
                if (company == null || System.Web.SiteMap.CurrentNode.ParentNode != null)
                {
                    screenTitle = PXSiteMap.CurrentNode.Title;
                }
                else
                {
                    screenTitle = company;
                }
            }
        }


        var date = PXContext.GetBusinessDate();

        if (date != null)
        {
            PXDateTimeEdit.SetDefaultDate((DateTime)date);
        }

        if (!Page.IsCallback)
        {
            Session.Remove("StoredSearch");
        }
        Uploader.FileUploadFinished += Uploader_FileUploadFinished;
        tlbTools.ItemCreate         += tlbTools_ItemCreate;
    }
Esempio n. 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        applicationName = Request.ApplicationPath.TrimEnd('/');
        pageUrl         = SharedFunctions.GetWebMethodPath(Request.Path);

        DateTime?startDateBridge;
        var      date = PXContext.GetBusinessDate();

        startDateBridge = (date != null) ? date : PXTimeZoneInfo.Now;

        // Filter By RefNbr
        RefNbr = Request.QueryString["RefNbr"];

        // External CustomerID
        CustomerID = Request.QueryString["CustomerID"];

        // Employee
        ExternalEmployee = Request.QueryString["EmployeeID"];

        // External SMEquipmentID
        SMEquipmentID = Request.QueryString["SMEquipmentID"];

        // Focus unassigned Appointment Tab
        AppSource = Request.QueryString["AppSource"];

        // Date
        try
        {
            if (!String.IsNullOrEmpty(Request.QueryString["Date"]))
            {
                startDateBridge = Convert.ToDateTime(Request.QueryString["Date"]);
            }
        }
        catch (Exception)
        {
        }

        var graphExternalControls = PXGraph.CreateInstance <ExternalControls>();
        var results = graphExternalControls.EmployeeSelected.Select();

        startDate = ((DateTime)startDateBridge).ToString("MM/dd/yyyy h:mm:ss tt", new CultureInfo("en-US"));

        PXResult <EPEmployee, Contact> result = (PXResult <EPEmployee, Contact>)results;

        EPEmployee epEmployeeRow = result;

        if (epEmployeeRow != null)
        {
            DefaultEmployee = epEmployeeRow.BAccountID.ToString();
        }

        if (string.IsNullOrEmpty(ExternalEmployee) && epEmployeeRow != null)
        {
            ExternalEmployee = DefaultEmployee;
        }

        // Load Appointment's Body to be used in index.aspx
        StreamReader streamReader = new StreamReader(Server.MapPath("../../Shared/templates/EventTemplate.html"));

        appointmentBodyTemplate = streamReader.ReadToEnd();
        streamReader.Close();

        // Load Service Order's ToolTip to be used in index.aspx
        streamReader = new StreamReader(Server.MapPath("../../Shared/templates/TooltipServiceOrder.html"));
        toolTipTemplateServiceOrder = streamReader.ReadToEnd();
        streamReader.Close();

        // Load Appointment's ToolTip to be used in index.aspx
        streamReader = new StreamReader(Server.MapPath("../../Shared/templates/TooltipAppointment.html"));
        toolTipTemplateAppointment = streamReader.ReadToEnd();
        streamReader.Close();
    }
Esempio n. 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        baseUrl = SharedFunctions.GetInstanceUrl(Request.Url.Scheme, Request.Url.Authority, Request.ApplicationPath.TrimEnd('/'));
        pageUrl = SharedFunctions.GetWebMethodPath(Request.Path);
        apiKey  = SharedFunctions.GetMapApiKey(new PX.Data.PXGraph());

        string   startDateRqst = Request.QueryString["Date"];
        DateTime?startDateBridge;

        // Filter By RefNbr
        RefNbr = Request.QueryString["RefNbr"];

        try{
            startDateBridge = (!String.IsNullOrEmpty(startDateRqst)) ? Convert.ToDateTime(startDateRqst) : PXContext.GetBusinessDate();
        } catch (Exception) {
            throw;
        }

        startDateBridge = (startDateBridge != null) ? startDateBridge : PXTimeZoneInfo.Now;

        startDate = ((DateTime)startDateBridge).ToString("MM/dd/yyyy h:mm:ss tt", new CultureInfo("en-US"));

        // Route Information
        StreamReader streamReader = new StreamReader(Server.MapPath("../../Shared/templates/InfoRoute.html"));

        infoRoute = streamReader.ReadToEnd();
        streamReader.Close();
    }
    //---------------------------------------------------------------------------
    /// <summary>
    /// The page Init event handler.
    /// </summary>
    protected void Page_Init(object sender, EventArgs e)
    {
        string hide = this.Page.Request.QueryString[PXUrl.HidePageTitle];

        if (!string.IsNullOrEmpty(hide))
        {
            this.Visible = false; return;
        }

        this.Page.InitComplete += new EventHandler(Page_InitComplete);

        if (PXDataSource.RedirectHelper.IsPopupPage(Page))
        {
            if (!PXList.Provider.HasList(PXSiteMap.CurrentNode.ScreenID))
            {
                tlbPath.Items["syncTOC"].Visible = false;
            }
            this.FavoriteAvailable = false;
            if (!PXDataSource.RedirectHelper.IsPopupInline(Page))
            {
                GetBranchCombo().Enabled = false;
            }
        }

        if (PXSiteMap.IsPortal)
        {
            this.CustomizationAvailable = PXAccess.GetAdministratorRoles().Any(System.Web.Security.Roles.IsUserInRole);
            this.BranchAvailable        = false;
            this.FavoriteAvailable      = false;
            pnlTBR.CssClass             = "panelTBRSP";
        }

        JSManager.RegisterModule(new MSScriptRenderer(Page.ClientScript), typeof(AppJS), AppJS.PageTitle);

        if (PXContext.PXIdentity.Authenticated)
        {
            userName = PXContext.PXIdentity.IdentityName;
            string branch = PXAccess.GetBranchCD();
            if (!string.IsNullOrEmpty(branch))
            {
                userName += ":" + branch;
            }
        }

        if (screenID == null)
        {
            this.screenID = ControlHelper.GetScreenID();
        }
        if (screenTitle == null)
        {
            this.screenID = ControlHelper.GetScreenID();
            //PX.Common.PXContext.SetScreenID(screenID); // moved to data source

            if (System.Web.SiteMap.CurrentNode != null)
            {
                if (company == null || System.Web.SiteMap.CurrentNode.ParentNode != null)
                {
                    screenTitle = PXSiteMap.CurrentNode.Title;
                }
                else
                {
                    screenTitle = company;
                }
            }
        }

        var date = PXContext.GetBusinessDate();

        if (date != null)
        {
            PXDateTimeEdit.SetDefaultDate((DateTime)date);
        }

        if (!Page.IsCallback)
        {
            Session.Remove("StoredSearch");
        }
        Uploader.FileUploadFinished += Uploader_FileUploadFinished;
        tlbTools.ItemCreate         += tlbTools_ItemCreate;
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        // remove unum parameter
        PropertyInfo isreadonly = typeof(System.Collections.Specialized.NameValueCollection).GetProperty("IsReadOnly", BindingFlags.Instance | BindingFlags.NonPublic);

        // make collection editable
        isreadonly.SetValue(this.Request.QueryString, false, null);
        this.Request.QueryString.Remove(PXUrl.UNum);
        isreadonly.SetValue(this.Request.QueryString, true, null);

        this.usrCaption.CustomizationAvailable = false;

        var date = PXContext.GetBusinessDate();

        PX.Common.PXContext.SetBusinessDate((DateTime?)date);

        if ((this.viewer.SchemaUrl = this.Request.QueryString["ID"]) == null)
        {
            this.viewer.SchemaUrl = ReportID;
        }

        if (SiteMap.CurrentNode != null)
        {
            this.Title = PXSiteMap.CurrentNode.Title;
            _screenID  = PXSiteMap.CurrentNode.ScreenID;
        }
        else
        {
            string url;
            if (Request.ApplicationPath != "/")
            {
                url = Request.Path.Replace(Request.ApplicationPath, "~") + "?ID=" + this.viewer.SchemaUrl;
            }
            else if (Request.Path.StartsWith("/"))
            {
                url = "~" + Request.Path;
            }
            else
            {
                url = Request.Path;
            }
            PXSiteMapNode node = SiteMap.Provider.FindSiteMapNode(url) as PXSiteMapNode;
            if (node != null)
            {
                this.Title = node.Title;
                this.usrCaption.ScreenTitle = node.Title;
                this.usrCaption.ScreenID    = PX.Common.Mask.Format(">CC.CC.CC.CC", node.ScreenID);
                _screenID = node.ScreenID;
            }
            else
            {
                using (PXDataRecord record = PXDatabase.SelectSingle <PX.SM.SiteMap>(
                           new PXDataField("ScreenID"),
                           new PXDataFieldValue("Url", PXDbType.VarChar, 512, url)
                           ))
                {
                    if (record != null)
                    {
                        _screenID = record.GetString(0);
                        if (!String.IsNullOrEmpty(_screenID) && !PXAccess.VerifyRights(_screenID))
                        {
                            throw new PXSetPropertyException(ErrorMessages.NotEnoughRights, this.viewer.SchemaUrl);
                        }
                    }
                }
            }
        }
        if (String.IsNullOrEmpty(PX.Common.PXContext.GetScreenID()))
        {
            if (String.IsNullOrEmpty(_screenID) && !String.IsNullOrEmpty(this.viewer.SchemaUrl))
            {
                string schema = this.viewer.SchemaUrl;
                if (schema.EndsWith(".rpx", StringComparison.OrdinalIgnoreCase))
                {
                    schema = schema.Substring(0, schema.Length - 4);
                }
                if (schema.Length == 8)
                {
                    _screenID = schema;
                }
            }
            if (!String.IsNullOrEmpty(_screenID))
            {
                PX.Common.PXContext.SetScreenID(PX.Common.Mask.Format(">CC.CC.CC.CC", _screenID));
            }
        }
        if (_canSendEmail)
        {
            viewer.EmailSend += new PXReportViewer.EmailSendHandler(viewer_EmailSend);
        }
        else
        {
            viewer.AllowSendEmails = false;
        }
    }