コード例 #1
0
ファイル: Utilities.cs プロジェクト: norio-soft/proteo
        public static Color GetJobStateColour(eJobState jobState)
        {
            switch (jobState)
            {
            case eJobState.Booked:
                return(Color.White);

            case eJobState.Planned:
                return(Color.FromName("CCFFCC"));

            case eJobState.InProgress:
                return(Color.FromName("99FF99"));

            case eJobState.Completed:
                return(Color.LightBlue);

            case eJobState.BookingInIncomplete:
                return(Color.MistyRose);

            case eJobState.BookingInComplete:
                return(Color.PaleVioletRed);

            case eJobState.ReadyToInvoice:
                return(Color.Yellow);

            case eJobState.Invoiced:
                return(Color.Gold);

            case eJobState.Cancelled:
                return(Color.Khaki);

            default:
                return(Color.Empty);
            }
        }
コード例 #2
0
 private void PopulateStaticControls()
 {
     // Display the job state legend
     foreach (HtmlTableRow row in tblLegend.Rows)
     {
         foreach (HtmlTableCell cell in row.Cells)
         {
             try
             {
                 eJobState jobState = (eJobState)Enum.Parse(typeof(eJobState), cell.InnerText.Replace(" ", ""), true);
                 cell.BgColor = Utilities.GetJobStateColour(jobState).Name;
             }
             catch {}
         }
     }
 }
コード例 #3
0
ファイル: jobSearch.aspx.cs プロジェクト: norio-soft/proteo
        private void GenerateStates(string stateQS)
        {
            m_jobStates = new ArrayList();
            if (stateQS == null || stateQS.Length == 0)
            {
                stateQS = "1,2,3,4,5,6,7,8";
            }

            string[] states = stateQS.Split(',');

            chkJobStates.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eJobState)));
            chkJobStates.DataBind();
            chkJobStates.ClearSelection();

            for (int index = 0; index < states.Length; index++)
            {
                try
                {
                    int jobStateId = Convert.ToInt32(states[index]);

                    if (jobStateId == 0)
                    {
                        foreach (ListItem item in chkJobStates.Items)
                        {
                            eJobState selectedState = (eJobState)Enum.Parse(typeof(eJobState), item.Text.Replace(" ", ""));
                            if (selectedState == eJobState.Booked || selectedState == eJobState.Planned || selectedState == eJobState.InProgress || selectedState == eJobState.Completed)
                            {
                                m_jobStates.Add(selectedState);

                                item.Selected = true;
                            }
                        }
                        break;
                    }
                    else
                    {
                        eJobState selectedState = (eJobState)jobStateId;
                        m_jobStates.Add(selectedState);

                        chkJobStates.Items.FindByValue(Utilities.UnCamelCase(selectedState.ToString())).Selected = true;
                    }
                }
                catch {}
            }
        }
コード例 #4
0
ファイル: Utilities.cs プロジェクト: norio-soft/proteo
        public static string GetJobStateColourForHTML(eJobState jobState)
        {
            Color colour = GetJobStateColour(jobState);

            byte zeroValue = 0;

            if (colour.R == zeroValue && colour.G == zeroValue && colour.B == zeroValue)
            {
                if (colour.Name.Length > 0)
                {
                    return("#" + colour.Name);
                }
                else
                {
                    return("#000000");
                }
            }
            else
            {
                return("#" + ConvertToHexString(colour.R, 2) + ConvertToHexString(colour.G, 2) + ConvertToHexString(colour.B, 2));
            }
        }
コード例 #5
0
ファイル: jobSearch.aspx.cs プロジェクト: norio-soft/proteo
        private void PopulateStaticControls()
        {
            cboJobSearchField.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eJobSearchField)));
            cboJobSearchField.DataBind();
            cboJobSearchField.ClearSelection();
            cboJobSearchField.Items.FindByText(Utilities.UnCamelCase(m_jobSearchField.ToString())).Selected = true;

            // Display the job state legend
            foreach (HtmlTableRow row in tblLegend.Rows)
            {
                foreach (HtmlTableCell cell in row.Cells)
                {
                    try
                    {
                        eJobState jobState = (eJobState)Enum.Parse(typeof(eJobState), cell.InnerText.Replace(" ", ""), true);
                        cell.BgColor = Utilities.GetJobStateColour(jobState).Name;
                    }
                    catch {}
                }
            }

            txtSearchFor.Text = m_searchString;
        }
コード例 #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage);

            if (!IsPostBack)
            {
                // Display the job state legend
                foreach (HtmlTableRow row in tblLegend.Rows)
                {
                    foreach (HtmlTableCell cell in row.Cells)
                    {
                        try
                        {
                            eJobState jobState = (eJobState)Enum.Parse(typeof(eJobState), cell.InnerText.Replace(" ", ""), true);
                            cell.BgColor = Utilities.GetJobStateColour(jobState).Name;
                        }
                        catch { }
                    }
                }

                BindJobData();
            }
        }
コード例 #7
0
        private void LoadGrid()
        {
            int       clientId  = 0;
            DateTime  startDate = DateTime.MinValue;
            DateTime  endDate   = DateTime.MinValue;
            eJobState jobState  = new eJobState();

            Facade.IOrganisation  facOrg = new Facade.Organisation();
            Entities.Organisation enOrg  = new Entities.Organisation();

            // Client
            if (cboClient.Text != "")
            {
                clientId          = Convert.ToInt32(cboClient.SelectedValue);
                pnlFilter.Visible = true;
            }

            if (cboClient.SelectedValue != "")
            {
                clientId          = Convert.ToInt32(cboClient.SelectedValue);
                enOrg             = facOrg.GetForIdentityId(Convert.ToInt32(cboClient.SelectedValue));
                cboClient.Text    = enOrg.OrganisationName;
                pnlFilter.Visible = true;
            }
            //else
            //    pnlFilter.Visible = false;

            // Date Range
            if (dteStartDate.SelectedDate != DateTime.MinValue)
            {
                startDate = dteStartDate.SelectedDate.Value;
                startDate = startDate.Subtract(startDate.TimeOfDay);
            }

            if (dteEndDate.SelectedDate != DateTime.MinValue)
            {
                endDate = dteEndDate.SelectedDate.Value;
                endDate = endDate.Subtract(endDate.TimeOfDay);
                endDate = endDate.Add(new TimeSpan(23, 59, 59));
            }

            // Get Jobs to Invoice
            Facade.IInvoice facInvoice = new Facade.Invoice();
            DataSet         dsInvoicing;

            bool posted = false;

            if (startDate != DateTime.MinValue || endDate != DateTime.MinValue)
            {
                dsInvoicing = facInvoice.GetJobsToInvoiceWithParamsAndDate(clientId, jobState, posted, startDate, endDate);
            }
            else
            {
                if (clientId == 0)
                {
                    dsInvoicing = facInvoice.GetAllJobsToInvoice();
                }
                else
                {
                    dsInvoicing = facInvoice.GetJobsToInvoiceWithParams(clientId, jobState, posted);
                }
            }

            // Check whether account is on hold
            if (dsInvoicing.Tables[0].Rows.Count > 0)
            {
                if (Convert.ToInt32(dsInvoicing.Tables[0].Rows[0]["OnHold"]) == 1)
                {
                    dlJob.Enabled = false;

                    if (string.IsNullOrEmpty(cboClient.Text))
                    {
                        lblOnHold.Visible = true;
                        lblOnHold.Text    = "Client accounts are on hold, please update their on-hold status in order to raise invoices.</A>";
                    }
                    else
                    {
                        lblOnHold.Visible = true;
                        lblOnHold.Text    = cboClient.Text + "'s account has been put on hold, please go to <A HREF=../Organisation/addupdateorganisation.aspx?IdentityId=" + Convert.ToInt32(cboClient.SelectedValue) + ">" + cboClient.Text + "'s details to change.</A>";
                    }
                }
                else
                {
                    lblOnHold.Visible = false;
                }

                dlJob.Visible = true;
            }
            else
            {
                lblOnHold.Visible = true;
                lblOnHold.Text    = "With the given parameters no jobs have been found.";
                dlJob.Visible     = false;
            }

            DataView dvInvoice = new DataView(dsInvoicing.Tables[0]);

            // Sort By
            foreach (ListItem sortField in rdoSortType.Items)
            {
                if (sortField.Selected)
                {
                    dvInvoice.Sort = sortField.Text.Replace(" ", "");
                }
            }

            // Load List
            dlJob.DataSource = dvInvoice;

            dlJob.DataBind();

            lblJobCount.Text = "There are " + dlJob.Items.Count.ToString() + " jobs ready to invoice.";

            pnlNormalJob.Visible = true;
            btnFilter.Visible    = true;
            btnFilter1.Visible   = true;
            btnClear.Visible     = true;
            btnClear1.Visible    = true;
            pnlSort.Visible      = true;
            lblJobCount.Visible  = true;
        }
コード例 #8
0
        private void LoadGrid()
        {
            int       clientId  = 0;
            DateTime  startDate = DateTime.MinValue;
            DateTime  endDate   = DateTime.MinValue;
            eJobState jobState  = new eJobState();

            // Client
            if (cboClient.Text != "")
            {
                clientId = Convert.ToInt32(cboClient.SelectedValue);
            }

            // Job State
            if (cboJobState.SelectedValue != string.Empty)
            {
                jobState = (eJobState)Enum.Parse(typeof(eJobState), cboJobState.SelectedValue.Replace(" ", ""));
            }

            // Date Range
            if (dteStartDate.SelectedDate != DateTime.MinValue)
            {
                startDate = dteStartDate.SelectedDate.Value;
                startDate = startDate.Subtract(startDate.TimeOfDay);
            }

            if (dteEndDate.SelectedDate != DateTime.MinValue)
            {
                endDate = dteEndDate.SelectedDate.Value;
                endDate = endDate.Subtract(endDate.TimeOfDay);
                endDate = endDate.Add(new TimeSpan(23, 59, 59));
            }

            // Get Jobs to Invoice
            Facade.IInvoice facInvoice = new Facade.Invoice();
            DataSet         dsInvoicing;

            bool posted = false;

            if (startDate != DateTime.MinValue || endDate != DateTime.MinValue)
            {
                dsInvoicing = facInvoice.GetJobsToInvoiceWithParamsAndDate(clientId, jobState, posted, startDate, endDate);
            }
            else
            {
                if (clientId == 0)
                {
                    dsInvoicing = facInvoice.GetAllJobsToInvoice();
                }
                else
                {
                    dsInvoicing = facInvoice.GetJobsToInvoiceWithParams(clientId, jobState, posted);
                }
            }

            // Check whether account is on hold
            if (dsInvoicing.Tables.Count > 0)
            {
                if (dsInvoicing.Tables[0].Rows.Count > 0)
                {
                    if (Convert.ToInt32(dsInvoicing.Tables[0].Rows[0]["OnHold"]) == 1)
                    {
                        dgJobs.Enabled    = false;
                        lblOnHold.Visible = true;
                        lblOnHold.Text    = cboClient.Text + "'s account has been put on hold, please go to <A HREF=../Organisation/addupdateorganisation.aspx?IdentityId=" + Convert.ToInt32(cboClient.SelectedValue) + ">" + cboClient.Text + "'s details to change.</A>";
                    }
                    else
                    {
                        lblOnHold.Visible = false;
                    }

                    dgJobs.Visible = true;
                }
                else
                {
                    lblOnHold.Visible    = true;
                    lblOnHold.Text       = "With the given parameters no jobs have been found.";
                    dgJobs.Visible       = false;
                    pnlNormalJob.Visible = false;
                    lblClient.Text       = "Client";
                    cboClient.Visible    = true;
                }

                // Put in dummy checkbox column
                dsInvoicing.Tables[0].Columns.Add("Include", typeof(Boolean));

                // Sort By
                DataView dvInvoice = new DataView(dsInvoicing.Tables[0]);

                if (chkOnlyShowTicked.Checked)
                {
                    if (m_selectedJobs.Count != 0)
                    {
                        dvInvoice.RowFilter = "jobId IN (" + hidSelectedJobs.Value + ")";
                    }
                }
                // Load List
                dgJobs.DataSource = dvInvoice;

                if (cboClient.SelectedValue == String.Empty)
                {
                    dgJobs.GroupBy = "OrganisationName";
                }
                else
                {
                    dgJobs.Levels[0].AllowGrouping = false;
                    dgJobs.Levels[0].Columns["OrganisationName"].Visible = false;
                }

                Session[C_EXPORTCSV_VS] = dvInvoice;

                dgJobs.DataBind();

                // Check All Now We Have Filtered Down
                if (dgJobs.Items.Count >= 1)
                {
                    btnExport.Visible = true;
                    ComponentArt.Web.UI.GridItem griditemMyRow;
                    decimal jobTotal = 0.0M;
                    int     jobCount = 0;

                    for (int i = 0; i <= dgJobs.Items.Count - 1; i++)
                    {
                        griditemMyRow = dgJobs.Items[i];

                        if (chkOnlyShowTicked.Checked)
                        {
                            griditemMyRow["Include"] = true;
                            jobTotal += Decimal.Parse(griditemMyRow["ChargeAmount"].ToString());
                            jobCount++;
                        }
                        else
                        {
                            int jobId = 0;

                            jobId = Convert.ToInt32(griditemMyRow["JobId"]);

                            if (m_selectedJobs.Contains(jobId.ToString()))
                            {
                                griditemMyRow["Include"] = true;
                                jobTotal += Decimal.Parse(griditemMyRow["ChargeAmount"].ToString());
                                jobCount++;
                            }
                        }
                    }

                    if (jobCount != 0)
                    {
                        lblDetails.Text   = "You have selected " + jobCount + " job(s), and the total amount is " + jobTotal.ToString("C");
                        hidJobTotal.Value = jobTotal.ToString();
                        hidJobCount.Value = jobCount.ToString();
                    }
                    else
                    {
                        hidJobTotal.Value = hidJobCount.Value = "0";
                        lblDetails.Text   = "";
                    }
                }
            }
            else
            {
                btnExport.Visible    = false;
                lblOnHold.Visible    = true;
                lblOnHold.Text       = "With the given parameters no jobs have been found.";
                dgJobs.Visible       = false;
                pnlNormalJob.Visible = false;
                lblClient.Text       = "Client";
                cboClient.Visible    = true;
            }

            if (dgJobs.Items.Count >= 1)
            {
                if (cboClient.Text != "")
                {
                    chkMarkAll.Visible = true;

                    // If these jobs ready for invoice show Create Invoice Button (ONLY FOR READY-FOR-INVOICE)
                    if (jobState == eJobState.ReadyToInvoice)
                    {
                        btnCreateInvoice.Visible = btnCreateInvoice2.Visible = true;
                    }

                    dgJobs.Levels[0].Columns[1].Visible = true;
                    btnSaveFilter.Visible = true;
                }
                else
                {
                    //TODO: dgJobs.GroupBy[2].ToString();
                    dgJobs.Levels[0].Columns[1].Visible = false;
                }
            }

            lblJobCount.Text = "There are " + dgJobs.Items.Count.ToString() + " jobs ready to invoice.";

            pnlNormalJob.Visible = true;
            btnFilter.Visible    = btnFilter2.Visible = true;
            btnClear.Visible     = btnClear2.Visible = true;
        }
コード例 #9
0
        private void dgJobsToBookIn_ItemContentCreated(object sender, GridItemContentCreatedEventArgs e)
        {
            try
            {
                int jobId = Convert.ToInt32(((HtmlInputHidden)e.Content.FindControl("hidJobId")).Value);

                if (jobId > 0)
                {
                    DataView dvJobRow = new DataView(m_dsJobsData.Tables[0]);
                    dvJobRow.RowFilter = "JobId = " + jobId.ToString();
                    eJobState jobState = (eJobState)Enum.Parse(typeof(eJobState), ((string)dvJobRow.Table.Rows[0]["JobState"]).Replace(" ", ""), true);

                    HtmlInputHidden hidJobState = (HtmlInputHidden)e.Content.FindControl("hidJobState");
                    HtmlInputHidden hidJobType  = (HtmlInputHidden)e.Content.FindControl("hidJobType");

                    if (hidJobState != null && hidJobType != null)
                    {
                        eJobType jobType = (eJobType)Enum.Parse(typeof(eJobType), ((string)dvJobRow.Table.Rows[0]["JobType"]).Replace(" ", ""), true);

                        GridServerTemplateContainer container = (GridServerTemplateContainer)e.Content;

                        if (jobState == eJobState.Booked || jobState == eJobState.Planned || jobState == eJobState.InProgress)
                        {
                            Facade.IJob facJob = new Facade.Job();
                            ((HtmlImage)e.Content.FindControl("imgRequiresCallIn")).Visible = facJob.RequiresCallIn(jobId);
                        }
                        else
                        {
                            ((HtmlImage)e.Content.FindControl("imgRequiresCallIn")).Visible = false;
                        }

                        HtmlImage imgHasRequests = (HtmlImage)e.Content.FindControl("imgHasRequests");
                        if (((int)dvJobRow[0]["Requests"]) == 0)
                        {
                            imgHasRequests.Visible = false;
                        }
                        else
                        {
                            imgHasRequests.Visible = true;
                            imgHasRequests.Attributes.Add("onClick", "javascript:ShowPlannerRequests('" + jobId.ToString() + "');");
                        }

                        HtmlAnchor lnkEditJob = (HtmlAnchor)e.Content.FindControl("lnkEditJob");
                        switch (jobType)
                        {
                        case eJobType.Normal:
                            lnkEditJob.HRef = "javascript:openResizableDialogWithScrollbars('../job/wizard/wizard.aspx?jobId=" + jobId.ToString() + "', '623', '508');";
                            break;

                        case eJobType.PalletReturn:
                            lnkEditJob.HRef = "../job/addupdatepalletreturnjob.aspx?jobId=" + jobId.ToString();
                            break;

                        case eJobType.Return:
                            lnkEditJob.HRef = "../job/addupdategoodsreturnjob.aspx?jobId=" + jobId.ToString();
                            break;

                        default:
                            lnkEditJob.Visible = false;
                            break;
                        }
                    }

                    Table tblCollections = (Table)e.Content.FindControl("tblCollections");
                    if (tblCollections != null)
                    {
                        tblCollections.BackColor = Utilities.GetJobStateColour(jobState);
                        DataView dvCollections = new DataView(m_dsJobsData.Tables[1]);
                        foreach (DataRow collection in dvCollections.Table.Rows)
                        {
                            if ((int)collection["JobId"] == jobId)
                            {
                                // This is a collection for the current job
                                ArrayList rows = CreateTableRows(collection);
                                foreach (TableRow row in rows)
                                {
                                    tblCollections.Rows.Add(row);
                                }
                            }
                        }
                    }

                    Table tblDeliveries = (Table)e.Content.FindControl("tblDeliveries");
                    if (tblDeliveries != null)
                    {
                        tblDeliveries.BackColor = Utilities.GetJobStateColour(jobState);
                        DataView dvDeliveries = new DataView(m_dsJobsData.Tables[2]);
                        foreach (DataRow delivery in dvDeliveries.Table.Rows)
                        {
                            if ((int)delivery["JobId"] == jobId)
                            {
                                // This is a delivery for the current job
                                ArrayList rows = CreateTableRows(delivery);
                                foreach (TableRow row in rows)
                                {
                                    tblDeliveries.Rows.Add(row);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                string error = exc.Message;
            }
        }
コード例 #10
0
ファイル: ListInvoice.aspx.cs プロジェクト: norio-soft/proteo
        private void performSubContractorSearch()
        {
            Facade.IInvoiceSubContrator facInvoice = new Facade.Invoice();

            int posted = 0;

            switch ((eWithOrWithout)Enum.Parse(typeof(eWithOrWithout), rdoPosted.SelectedValue))
            {
            case eWithOrWithout.All:
                posted = 2;
                break;

            case eWithOrWithout.With:
                posted = 1;
                break;

            case eWithOrWithout.Without:
                posted = 0;
                break;
            }

            int clientId = cboSubContractor.SelectedValue == "" ? 0 : Convert.ToInt32(cboSubContractor.SelectedValue);

            string clientInvoiceNumber = String.Empty;

            if (txtClientInvoiceNumber.Text != string.Empty)
            {
                clientInvoiceNumber = txtClientInvoiceNumber.Text;
            }

            DateTime startDate = DateTime.MinValue;
            DateTime endDate   = DateTime.MinValue;

            if (dteStartDate.SelectedDate.HasValue)
            {
                startDate = dteStartDate.SelectedDate.Value;
                startDate = startDate.Subtract(startDate.TimeOfDay);
            }

            if (dteEndDate.SelectedDate.HasValue)
            {
                endDate = dteEndDate.SelectedDate.Value;
                endDate = endDate.Subtract(endDate.TimeOfDay);
                endDate = endDate.Add(new TimeSpan(23, 59, 59));
            }

            // Job State
            eJobState jobState = new eJobState();

            if (cboJobState.SelectedValue != string.Empty)
            {
                jobState = (eJobState)Enum.Parse(typeof(eJobState), cboJobState.SelectedValue);
            }

            if (startDate != DateTime.MinValue && endDate != DateTime.MinValue)
            {
                dsInvoice = facInvoice.GetSubContractorswithParamsAndDate(clientId, clientInvoiceNumber, jobState, posted, startDate, endDate, eInvoiceType.SubContract);
            }
            else
            {
                if (clientId == 0)
                {
                    dsInvoice = facInvoice.GetSubContractors(posted, eInvoiceType.SubContract);
                }
                else
                {
                    dsInvoice = facInvoice.GetSubContractorswithParams(clientId, clientInvoiceNumber, jobState, posted, eInvoiceType.SubContract);
                }
            }

            gvSubContratorInvoice.DataSource = dsInvoice;

            ViewState[C_InvoiceDATA_VS] = dsInvoice;

            gvSubContratorInvoice.DataBind();


            if (gvSubContratorInvoice.Rows.Count == 0)
            {
                pnlSubContractorInvoice.Visible = false;
                lblNote.Text      = "There are no invoices for the given criteria.";
                lblNote.ForeColor = Color.Red;
                lblNote.Visible   = true;
            }
            else
            {
                pnlSubContractorInvoice.Visible = true;
            }

            lblClientInvoiceNumber.Visible = txtClientInvoiceNumber.Visible = true;
        }
コード例 #11
0
ファイル: ListInvoice.aspx.cs プロジェクト: norio-soft/proteo
        private void performSelfBillSearch()
        {
            Facade.IInvoice facInvoice = new Facade.Invoice();

            eInvoiceType searchInvoiceType = eInvoiceType.SelfBill;

            switch ((eInvoiceFilterType)Enum.Parse(typeof(eInvoiceFilterType), rdoFilterOptions.SelectedValue.Replace(" ", "")))
            {
            case eInvoiceFilterType.SelfBillInvoice:
                searchInvoiceType = eInvoiceType.SelfBill;
                break;

            case eInvoiceFilterType.Extra:
                searchInvoiceType = eInvoiceType.Extra;
                break;

            default:
                searchInvoiceType = eInvoiceType.Normal;
                break;
            }
            int posted = 0;

            switch ((eWithOrWithout)Enum.Parse(typeof(eWithOrWithout), rdoPosted.SelectedValue))
            {
            case eWithOrWithout.All:
                posted = 2;
                break;

            case eWithOrWithout.With:
                posted = 1;
                break;

            case eWithOrWithout.Without:
                posted = 0;
                break;
            }

            int clientId = cboClient.SelectedValue == "" ? 0 : Convert.ToInt32(cboClient.SelectedValue);

            string clientInvoiceNumber = string.Empty;

            if (txtClientInvoiceNumber.Text != string.Empty)
            {
                clientInvoiceNumber = txtClientInvoiceNumber.Text;
            }

            DateTime startDate = dteStartDate.SelectedDate.Value;

            startDate = startDate.Subtract(startDate.TimeOfDay);

            DateTime endDate = dteEndDate.SelectedDate.Value;

            endDate = endDate.Subtract(endDate.TimeOfDay);
            endDate = endDate.Add(new TimeSpan(23, 59, 59));

            // Job State
            eJobState jobState = new eJobState();

            if (cboJobState.SelectedValue != string.Empty)
            {
                jobState = (eJobState)Enum.Parse(typeof(eJobState), cboJobState.SelectedValue);
            }

            if (startDate != DateTime.MinValue && endDate != DateTime.MinValue)
            {
                dsInvoice = facInvoice.GetwithParamsAndDate(clientId, clientInvoiceNumber, jobState, posted, startDate, endDate, searchInvoiceType);
            }
            else
            {
                if (clientId == 0)
                {
                    dsInvoice = facInvoice.GetAll(posted, searchInvoiceType);
                }
                else
                {
                    dsInvoice = facInvoice.GetwithParams(clientId, clientInvoiceNumber, jobState, posted, searchInvoiceType);
                }
            }

            gvInvoices.Columns[7].Visible = true;
            gvInvoices.DataSource         = dsInvoice;

            ViewState[C_InvoiceDATA_VS] = dsInvoice;

            gvInvoices.DataBind();

            if (gvInvoices.Rows.Count == 0)
            {
                pnlNormalInvoice.Visible = false;
                lblNote.Text             = "There are no invoices for the given criteria.";
                lblNote.ForeColor        = Color.Red;
                lblNote.Visible          = true;
            }
            {
                pnlNormalInvoice.Visible = true;
                gvInvoices.Visible       = true;
            }
        }
コード例 #12
0
ファイル: Future.aspx.cs プロジェクト: norio-soft/proteo
        private void dgBasicJobs_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            ListItemType itemType = e.Item.ItemType;

            if (itemType == ListItemType.Item || itemType == ListItemType.AlternatingItem || itemType == ListItemType.SelectedItem)
            {
                string jobIdText = ((HtmlInputHidden)e.Item.FindControl("hidJobId")).Value;

                try
                {
                    int jobId = Convert.ToInt32(jobIdText);

                    if (jobId > 0)
                    {
                        DataRowView dataItem = (DataRowView)e.Item.DataItem;
                        eJobState   jobState = (eJobState)Enum.Parse(typeof(eJobState), e.Item.Cells[2].Text.Replace(" ", ""), true);

                        e.Item.BackColor = Utilities.GetJobStateColour(jobState);

                        if (jobState == eJobState.Booked || jobState == eJobState.Planned || jobState == eJobState.InProgress)
                        {
                            Facade.IJob facJob = new Facade.Job();
                            ((HtmlImage)e.Item.FindControl("imgRequiresCallIn")).Visible = facJob.RequiresCallIn(jobId);
                        }
                        else
                        {
                            ((HtmlImage)e.Item.FindControl("imgRequiresCallIn")).Visible = false;
                        }

                        // Configure the toggle ownership button
                        CheckBox chkOwnership = (CheckBox)e.Item.FindControl("chkOwnership");
                        bool     isMyJob      = ((int)dataItem.Row["DoesOwn"] == 1);
                        chkOwnership.Checked = isMyJob;

                        HtmlImage imgHasRequests = (HtmlImage)e.Item.FindControl("imgHasRequests");
                        if (((int)dataItem.Row["Requests"]) == 0)
                        {
                            imgHasRequests.Visible = false;
                        }
                        else
                        {
                            imgHasRequests.Visible = true;
                            imgHasRequests.Attributes.Add("onClick", "javascript:ShowPlannerRequests('" + jobId.ToString() + "');");
                        }

                        Table tblCollections = (Table)e.Item.FindControl("tblCollections");

                        DataView dvCollections = new DataView(m_dsFutureJobs.Tables[1]);
                        foreach (DataRow collection in dvCollections.Table.Rows)
                        {
                            if ((int)collection["JobId"] == jobId)
                            {
                                // This is a collection for the current job
                                ArrayList rows = CreateTableRows(collection);
                                foreach (TableRow row in rows)
                                {
                                    tblCollections.Rows.Add(row);
                                }
                            }
                        }

                        Table tblDeliveries = (Table)e.Item.FindControl("tblDeliveries");

                        DataView dvDeliveries = new DataView(m_dsFutureJobs.Tables[2]);
                        foreach (DataRow delivery in dvDeliveries.Table.Rows)
                        {
                            if ((int)delivery["JobId"] == jobId)
                            {
                                // This is a collection for the current job
                                ArrayList rows = CreateTableRows(delivery);
                                foreach (TableRow row in rows)
                                {
                                    tblDeliveries.Rows.Add(row);
                                }
                            }
                        }
                    }
                }
                catch (Exception exc)
                {
                    string error = exc.Message;
                }
            }
        }