예제 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.Invoicing);

            if (!IsPostBack)
            {
                // Check whether the user has any previous pre-invoices to sort
                string userName = ((Entities.CustomPrincipal)Page.User).UserName;

                Facade.IInvoice facInv = new Facade.Invoice();

                m_dsPrevious = facInv.GetPreviousPreInvoiceForUserName(userName);

                if (m_dsPrevious.Tables[0].Rows != null)
                {
                    if (m_dsPrevious.Tables[0].Rows.Count != 0)
                    {
                        btnReload.Visible = true;

                        ViewState[C_BASE_LOCATION_VS]       = m_dsPrevious.Tables[0].Rows[0]["FileLocation"].ToString();
                        ViewState[C_FILE_NAME_ON_SERVER_VS] = m_dsPrevious.Tables[0].Rows[0]["FileName"].ToString();

                        string filename = m_dsPrevious.Tables[0].Rows[0]["FileName"].ToString();
                        cboClient.Text          = m_dsPrevious.Tables[0].Rows[0]["OrganisationName"].ToString();
                        cboClient.SelectedValue = m_dsPrevious.Tables[0].Rows[0]["ClientId"].ToString();

                        m_dsPrevious = LoadFileToDataSet(m_dsPrevious.Tables[0].Rows[0]["FileLocation"].ToString(), m_dsPrevious.Tables[0].Rows[0]["FileName"].ToString());

                        if (m_dsPrevious != null)
                        {
                            CompareFileWithHMS(m_dsPrevious);
                        }

                        if (dgJobDiscrepancies.Items.Count != 0)
                        {
                            txtOutput.InnerHtml = "The previous invoice (<b>" + filename.ToString() + "</b>) has been loaded as the discrepancies required attention.";
                        }
                    }
                }
            }
            else
            {
                m_baseLocation     = (string)ViewState[C_BASE_LOCATION_VS];
                m_fileNameOnServer = (string)ViewState[C_FILE_NAME_ON_SERVER_VS];
            }
        }