Exemplo n.º 1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage, eSystemPortion.TakeCallIn);
            m_canEdit = Orchestrator.WebUI.Security.Authorise.CanAccess(eSystemPortion.TakeCallIn);
            btnStoreShortage.Enabled = m_canEdit;

            m_jobId         = Convert.ToInt32(Request.QueryString["jobId"]);
            m_instructionId = Convert.ToInt32(Request.QueryString["instructionId"]);
            if (m_instructionId == 0)
            {
                Response.Redirect("tabProgress.aspx?wiz=true&jobId=" + m_jobId.ToString() + "&csid=" + this.CookieSessionID);
            }
            else
            {
                Facade.IInstructionActual facInstructionActual = new Facade.Instruction();
                DataSet dsInstructionActual = facInstructionActual.GetForInstructionId(m_instructionId);

                if (dsInstructionActual.Tables[0].Rows.Count == 0)
                {
                    Response.Redirect("tabProgress.aspx?wiz=true&jobId=" + m_jobId.ToString() + "&csid=" + this.CookieSessionID);
                }
            }

            try
            {
                hidShortageId.Value = Convert.ToInt32(Request.QueryString["refusalId"]).ToString();
            }
            catch { }
            ConfigureReasons();

            // Set please wait button clicks!
            btnStoreShortage.Attributes.Add("onMouseUp", @"javascript:HideTop(true);");

            if (!IsPostBack)
            {
                LoadJob();
                using (Facade.IInstruction facInstruction = new Facade.Instruction())
                    cboShortageDocket.DataSource = facInstruction.GetDocketsForInstructionId(m_instructionId);

                cboShortageDocket.DataTextField  = "DocketNumberDisplay";
                cboShortageDocket.DataValueField = "DocketNumber";
                cboShortageDocket.DataBind();

                Facade.IOrder facOrder = new Facade.Order();
                cboOrder.DataSource = facOrder.GetOrdersForInstructionID(m_instructionId);
                cboOrder.DataBind();

                if (hidShortageId.Value != "0")
                {
                    BindShortage(Convert.ToInt32(hidShortageId.Value));
                }
                else
                {
                    ClearShortages();
                }
            }
            else
            {
                if (m_instructionId == 0)
                {
                    m_instructionId = Convert.ToInt32(hidInstructionId.Value);
                }
                m_job = (Entities.Job)ViewState[C_JOB_VS];
            }

            if (((Entities.CustomPrincipal) this.Page.User).IsInRole(((int)eUserRole.SubConPortal).ToString()))
            {
                this.buttonBar.Visible = false;
            }

            hidInstructionId.Value = m_instructionId.ToString();
        }