Пример #1
0
        private void UpdateBusinessType()
        {
            // Populate the BusinessType
            PopulateBusinessType();

            Facade.IBusinessType  facBusinessType      = new Facade.BusinessType();
            Entities.FacadeResult retVal               = new Orchestrator.Entities.FacadeResult();
            bool AllowNominalCodeReUseForBusinessTypes = Orchestrator.Globals.Configuration.AllowNominalCodeReUseForBusinessTypes;

            if (this.BusinessTypeID > 0)
            {
                retVal = facBusinessType.Update(this.businessType, this.Page.User.Identity.Name, AllowNominalCodeReUseForBusinessTypes);
            }
            else
            {
                retVal = facBusinessType.Create(this.businessType, this.Page.User.Identity.Name, AllowNominalCodeReUseForBusinessTypes);
            }
            if (retVal.Success)
            {
                Response.Redirect("businesstypes.aspx");
            }
            else
            {
                ucInfringements.Infringements = retVal.Infringements;
                ucInfringements.DisplayInfringments();
            }
        }
Пример #2
0
        private void BindRepeater()
        {
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            Facade.IOrganisation facOrganisation = new Facade.Organisation();

            var selectedDrivers = hidSelectedDriversValues.Value;
            var driverList      = selectedDrivers.Split(',').ToList();

            Facade.IDriver facDriver = new Facade.Resource();

            DataSet ds = facDriver.GetAllDrivers(false);

            var drivers = from driver in ds.Tables[0].AsEnumerable()
                          select driver;

            if (!cbSelectedAllDrivers.Checked)
            {
                drivers = from driver in ds.Tables[0].AsEnumerable()
                          where driverList.Contains(driver.Field <int>("ResourceId").ToString())
                          select driver;
            }

            repDrivers.DataSource = drivers;
            repDrivers.DataBind();

            grdSummary.Rebind();

            AllWorkForDriver = null;
        }
Пример #3
0
        public List <PalletForceOrder> GetOrdersForPalletNetworkExport(DateTime trunkDate)
        {
            // Search for orders based on Date Range Status and text
            // Determine the parameters
            List <int> orderStatusIDs = new List <int>();

            orderStatusIDs.Add((int)eOrderStatus.Approved);
            orderStatusIDs.Add((int)eOrderStatus.Delivered);
            orderStatusIDs.Add((int)eOrderStatus.Invoiced);

            // Set the Business Types
            List <int> BusinessTypes = new List <int>();

            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            DataSet dsBusinessTypes = facBusinessType.GetAll();

            foreach (DataRow row in dsBusinessTypes.Tables[0].Rows)
            {
                BusinessTypes.Add(int.Parse(row["BusinessTypeID"].ToString()));
            }
            // Retrieve the client id, resource id, and sub-contractor identity id.
            int clientID   = 0;
            int resourceID = 0;
            int subContractorIdentityID = Globals.Configuration.PalletNetworkID;

            int collectionPointId = 0;
            int deliveryPointId   = 0;

            int goodsType = 0;


            Facade.IOrder facOrder  = new Facade.Order();
            DataSet       orderData = null;

            orderData = facOrder.Search(orderStatusIDs, trunkDate, trunkDate, String.Empty, false, false, true, false, clientID, resourceID, subContractorIdentityID, BusinessTypes, collectionPointId, deliveryPointId, goodsType);
            List <PalletForceOrder> orders = new List <PalletForceOrder>();

            orders = (from row in orderData.Tables[0].AsEnumerable()
                      select new PalletForceOrder()
            {
                OrderID = row.Field <int>("OrderID"),
                JobID = row.Field <int>("JobID"),
                CustomerOrganisationName = row.Field <string>("CustomerOrganisationName"),
                DeliveryPointDescription = row.Field <string>("DeliveryPointDescription"),
                DeliveryOrderNumber = row.Field <string>("DeliveryOrderNumber"),
                CustomerOrderNumber = row.Field <string>("CustomerOrderNumber"),
                NoPallets = row.Field <int>("NoPallets"),
                PalletSpaces = row.Field <decimal>("PalletSpaces"),
                Weight = row.Field <decimal>("Weight"),
                HalfPallets = row.Field <int>("HalfPallets"),
                QtrPallets = row.Field <int>("QtrPallets"),
                FullPallets = row.Field <int>("FullPallets"),
                OverPallets = row.Field <int>("OverPallets"),
                MessageStateID = row.IsNull("MessageStateID") ? (int?)null : row.Field <int>("MessageStateID"),
                DeliveryDateTimeLabel = GetTime(row.Field <DateTime>("DeliveryFromDateTime"), row.Field <DateTime>("DeliveryDateTime")),
                Surcharges = GetSurcharges(row.Field <int>("OrderID"))
            }).ToList();

            return(orders);
        }
Пример #4
0
        private void LoadJob()
        {
            int jobID = int.Parse(Request.QueryString["jID"]);

            Orchestrator.Entities.Job job    = null;
            Orchestrator.Facade.IJob  facJob = new Orchestrator.Facade.Job();
            job = facJob.GetJob(jobID);

            Facade.IBusinessType  facBusinessType = new Facade.BusinessType();
            Entities.BusinessType businessType    = facBusinessType.GetForBusinessTypeID(job.BusinessTypeID);

            if (businessType != null)
            {
                lblBusinessType.Text = businessType.Description;
            }
            else
            {
                lblBusinessType.Text = "No Business Type Set";
            }

            DataSet dsTypes = facBusinessType.GetAll();

            cboBusinessType.DataSource     = dsTypes;
            cboBusinessType.DataTextField  = "Description";
            cboBusinessType.DataValueField = "BusinessTypeID";
            cboBusinessType.DataBind();

            if (businessType != null)
            {
                cboBusinessType.FindItemByValue(businessType.BusinessTypeID.ToString()).Selected = true;
                this.CurrentBusinessTypeID = businessType.BusinessTypeID;
            }
        }
Пример #5
0
        private void PopulateStaticControls()
        {
            cblOrderStatus.DataSource = Enum.GetNames(typeof(eOrderStatus));
            cblOrderStatus.DataBind();

            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            cboBusinessType.DataSource = facBusinessType.GetAll();
            cboBusinessType.DataBind();
        }
Пример #6
0
        void grdBusinessTypes_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            DataSet ds = facBusinessType.GetAll();

            if (!e.IsFromDetailTable)
            {
                grdBusinessTypes.MasterTableView.DataSource = ds.Tables[0];
            }

            grdBusinessTypes.MasterTableView.DetailTables[0].DataSource = ds.Tables[1];
        }
Пример #7
0
        private void BindRepeater()
        {
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            DataSet dsBusinessType = null;

            dsBusinessType = facBusinessType.GetAll();

            repBusinessType.DataSource = dsBusinessType;
            repBusinessType.DataBind();
            grdNormal.Rebind();
            grdSummary.Rebind();
        }
Пример #8
0
        private void ConfigureDisplay()
        {
            string headerText = "Rate";

            if (this.PreInvoiceID > 0)
            {
                Facade.IPalletForceImportPreInvoice facPreInvoice = new Facade.PreInvoice();
                PFInvoice = facPreInvoice.GetImportedInvoiceForPreInvoiceID(PreInvoiceID, true);
                ItemIDs   = PFInvoice.GetOrdersOnInvoice();

                switch (PFInvoice.InvoiceType)
                {
                case eInvoiceType.PFDepotCharge:
                    headerText = "Sub Contract Rate";
                    break;

                case eInvoiceType.PFHubCharge:
                    headerText = "Hub Charge";
                    break;

                case eInvoiceType.PFSelfBillDeliveryPayment:
                    headerText = "Order Rate";
                    break;
                }

                if (consignmentNo != String.Empty)
                {
                    lblRefCaption.Text = "Consignment No";
                    lblRef.Text        = txtSearch.Text = consignmentNo;
                }
            }
            else
            if (LoadNo != String.Empty)
            {
                lblRefCaption.Text = "Load No";
                lblRef.Text        = txtSearch.Text = LoadNo;
            }

            grdOrders.Columns.FindByUniqueName("CurrentRate").HeaderText = headerText;

            dteStartDate.SelectedDate = new DateTime(DateTime.Today.Year, DateTime.Today.AddMonths(-1).Month, DateTime.Today.Day);
            dteEndDate.SelectedDate   = DateTime.Today;

            Facade.IBusinessType facBT = new Facade.BusinessType();
            cblBusinessType.DataSource = facBT.GetAll();
            cblBusinessType.DataBind();

            foreach (ListItem li in cblBusinessType.Items)
            {
                li.Selected = true;
            }
        }
Пример #9
0
        //--------------------------------------------------------------------------------------------------------------------------

        private void LoadBusinessTypes()
        {
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            DataSet dsBusinessTypes = facBusinessType.GetAll();

            foreach (DataRow row in dsBusinessTypes.Tables[0].Rows)
            {
                ListItem li = new ListItem(row["Description"].ToString(), row["BusinessTypeID"].ToString());
                // Select all the business types by default.
                li.Selected = true;
                cblBusinessType.Items.Add(li);
            }
        }
Пример #10
0
        /// <summary>
        /// Offer the user creating the job a choice of which business type the job should be.
        /// The default value is the business type which has the most pallets (based on the
        /// individual pallet count and business type of each order being added to the job).
        /// </summary>
        /// <param name="orders">The data set containing the order information.</param>
        private void ConfigureBusinessTypeChoices(DataSet orders)
        {
            // Clear the current business type options down.
            cboBusinessType.ClearSelection();
            cboBusinessType.Items.Clear();

            // Store a list of key value pairs that represents the total pallets involved for each business type.
            // In each item in the list the Key is the Business Type ID, and the Value is the pallet count for that
            // business type.
            List <KeyValuePair <int, int> > btCounts = new List <KeyValuePair <int, int> >();

            if (orders != null && orders.Tables.Count > 0 && orders.Tables[0] != null)
            {
                foreach (DataRow order in orders.Tables[0].Rows)
                {
                    int businessTypeID = (int)order["BusinessTypeID"];
                    int palletCount    = (int)order["NoPallets"];

                    // The business type has already been encountered, increase the pallet count.
                    // As the value property is read only, we need to remove the item and then
                    // cause it to be recreated with the new total.
                    if (btCounts.Exists(btCount => btCount.Key == businessTypeID))
                    {
                        palletCount += btCounts.Find(btCount => btCount.Key == businessTypeID).Value;
                        btCounts.RemoveAll(btCount => btCount.Key == businessTypeID);
                    }

                    // Record the entry.
                    btCounts.Add(new KeyValuePair <int, int>(businessTypeID, palletCount));
                }

                // Sort the different key value pairs based on their value properties (i.e. their pallet count).
                // The result of the value compare is multiplied by -1 to effectively reverse the sort direction as:
                //      -1 * -1 =  1
                //       1 * -1 = -1
                //       0 * -1 =  0
                btCounts.Sort((x, y) => x.Value.CompareTo(y.Value) * -1);
            }

            // Create the dropdown items that match the business type information.
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            foreach (KeyValuePair <int, int> btCount in btCounts)
            {
                ListItem li = new ListItem();
                li.Value = btCount.Key.ToString();
                Entities.BusinessType businessType = facBusinessType.GetForBusinessTypeID(btCount.Key);
                li.Text = string.Format("{0} ({1})", businessType.Description, btCount.Value);

                cboBusinessType.Items.Add(li);
            }
        }
Пример #11
0
        private void LoadBusinessType()
        {
            Facade.IBusinessType facBT = new Facade.BusinessType();
            this.businessType = facBT.GetForBusinessTypeID(this.BusinessTypeID);

            txtDescription.Text = this.businessType.Description;
            rblDeBreifRequired.ClearSelection();
            rblDeBreifRequired.Items[0].Selected  = this.businessType.RequireDeBreif;
            rblDeBreifRequired.Items[1].Selected  = !this.businessType.RequireDeBreif;
            rblShowCreateJob.Items[0].Selected    = this.businessType.ShowCreateJob;
            rblShowCreateJob.Items[1].Selected    = !this.businessType.ShowCreateJob;
            rblCreateJobChecked.Items[0].Selected = this.businessType.CreateJobChecked;
            rblCreateJobChecked.Items[1].Selected = !this.businessType.CreateJobChecked;
            rblExcludeFromConsortiumMemberFileExport.SelectedIndex   = this.businessType.ExcludeFromConsortiumMemberFileExport ? 0 : 1;
            rblIsBarcodeScannedOnDelivery.SelectedIndex              = this.businessType.IsBarcodeScannedOnDelivery ? 0 : 1;
            rblIsCustomerNameCapturedOnCollection.SelectedIndex      = this.businessType.IsCustomerNameCapturedOnCollection ? 0 : 1;
            rblIsCustomerNameCapturedOnDelivery.SelectedIndex        = this.businessType.IsCustomerNameCapturedOnDelivery ? 0 : 1;
            rblIsCustomerSignatureCapturedOnCollection.SelectedIndex = this.businessType.IsCustomerSignatureCapturedOnCollection ? 0 : 1;
            rblIsCustomerSignatureCapturedOnDelivery.SelectedIndex   = this.businessType.IsCustomerSignatureCapturedOnDelivery ? 0 : 1;
            rblMwfBypassCleanClausedScreen.SelectedIndex             = this.businessType.MwfBypassCleanClausedScreen ? 0 : 1;
            rblMwfBypassCommentsScreen.SelectedIndex = this.businessType.MwfBypassCommentsScreen ? 0 : 1;
            rblMwfConfirmCallIn.SelectedIndex        = this.businessType.MwfConfirmCallIn ? 0 : 1;

            txtPalletThresholdMin.Text = this.businessType.PalletThresholdMin.ToString();
            txtPalletThresholdMax.Text = this.businessType.PalletThresholdMax.ToString();

            chkPalletNetwork.Checked             = this.businessType.IsPalletNetwork;
            txtPalletNetworkExportDepotCode.Text = this.businessType.PalletNetworkExportDepotCode;

            if (this.businessType.NominalCode.NominalCodeID > 0)
            {
                cboDefaultNominalCode.ClearSelection();
                cboDefaultNominalCode.FindItemByValue(this.businessType.NominalCode.NominalCodeID.ToString()).Selected = true;
            }

            if (this.businessType.SubContractNominalCode.NominalCodeID > 0)
            {
                cboSubContractNominalCode.ClearSelection();
                cboSubContractNominalCode.FindItemByValue(this.businessType.SubContractNominalCode.NominalCodeID.ToString()).Selected = true;
            }

            if (this.businessType.SubContractSelfBillNominalCode.NominalCodeID > 0)
            {
                cboSubContractSelfBillNominalCode.ClearSelection();
                cboSubContractSelfBillNominalCode.FindItemByValue(this.businessType.SubContractSelfBillNominalCode.NominalCodeID.ToString()).Selected = true;
            }

            btnUpdate.Text = "Update";
        }
Пример #12
0
        private string GetBusinessTypeDescription(int businessTypeID)
        {
            string description = String.Empty;

            if (!_businessTypeDescriptions.TryGetValue(businessTypeID, out description))
            {
                // Load the description from the database and add it to the dictionary.
                Facade.BusinessType facBusinessType = new Facade.BusinessType();
                var bt = facBusinessType.GetForBusinessTypeID(businessTypeID);
                description = bt.Description;
                _businessTypeDescriptions.Add(bt.BusinessTypeID, bt.Description);
            }

            return(description);
        }
Пример #13
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (Page.IsCallback)
            {
                return;
            }

            m_jobId   = Convert.ToInt32(Request.QueryString["jobId"]);
            m_isStock = Convert.ToBoolean(Request.QueryString["isStock"]);

            if (m_jobId > 0)
            {
                m_isUpdate              = true;
                cboClient.Enabled       = false;
                cboBusinessType.Enabled = false;
            }

            if (m_isUpdate)
            {
                GoToStep("JD");
            }

            if (!IsPostBack)
            {
                btnCancel.Attributes.Add("onClick", wizard.C_CONFIRM_MESSAGE);

                Facade.IBusinessType facBusinessType = new Facade.BusinessType();
                cboBusinessType.DataSource = facBusinessType.GetAll();
                cboBusinessType.DataBind();

                cboClient.Focus();
                if (Session[wizard.C_JOB] != null)
                {
                    m_job = (Entities.Job)Session[wizard.C_JOB];
                    PopulateClient();
                    cboBusinessType.ClearSelection();
                    cboBusinessType.Items.FindByValue(m_job.BusinessTypeID.ToString()).Selected = true;
                }
            }
            else
            {
                m_job = (Entities.Job)Session[wizard.C_JOB];
            }

//			infringementDisplay.Visible = false;
        }
Пример #14
0
        private void BindRepeater()
        {
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            DataSet dsBusinessType;

            int identityID;

            int.TryParse(cboClient.SelectedValue, out identityID);

            organisation = facOrganisation.GetForIdentityId(identityID);

            dsBusinessType = facBusinessType.GetAll();

            repBusinessType.DataSource = dsBusinessType;
            repBusinessType.DataBind();
            grdNormal.Rebind();
            grdSummary.Rebind();
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Security.Authorise.EnforceAuthorisation(eSystemPortion.AddEditOrder);

            if (!IsPostBack)
            {
                btnCreateCollection.PostBackUrl = "collectionjob.aspx";
                //TODO: Replace this on Collection and Deliveries
                //dteStartDate.MinValue = DateTime.Today;
                Facade.ITrafficArea facTrafficArea = new Facade.Traffic();
                cblTrafficAreas.DataSource = facTrafficArea.GetAll();
                cblTrafficAreas.DataBind();

                Facade.IBusinessType facBusinessType = new Facade.BusinessType();
                DataSet dsBusinessTypes = facBusinessType.GetAll();

                cblBusinessTypes.DataSource = dsBusinessTypes;
                cblBusinessTypes.DataBind();

                foreach (DataRow row in dsBusinessTypes.Tables[0].Rows)
                {
                    RadMenuItem rmi = new RadMenuItem();
                    rmi.Text  = row["Description"].ToString();
                    rmi.Value = row["BusinessTypeID"].ToString();
                    RadMenu1.Items.Add(rmi);
                }

                if (Session[C_ONLYSHOWNONCOLLECTED] != null && Session[C_ONLYSHOWNONCOLLECTED] is bool)
                {
                    chkShowUnPlannedOnly.Checked = (bool)Session[C_ONLYSHOWNONCOLLECTED];
                }

                // Get the Dates from the filter if one exists
                GetDates();
            }
        }
Пример #16
0
        private void ConfigureContextMenu()
        {
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            DataSet dsBusinessTypes = facBusinessType.GetAll();

            //Top level context menu items.
            RadMenuItem cbt = new RadMenuItem("Change Business Type To");
            RadMenuItem cdn = new RadMenuItem("Create Delivery Note");

            cdn.Value = "-1";

            //Create business type menu items.
            foreach (DataRow row in dsBusinessTypes.Tables[0].Rows)
            {
                RadMenuItem rmi = new RadMenuItem();
                rmi.Text  = row["Description"].ToString();
                rmi.Value = row["BusinessTypeID"].ToString();
                cbt.Items.Add(rmi);
            }

            //Add items to context menu.
            RadMenu1.Items.Add(cbt);
            RadMenu1.Items.Add(cdn);
        }
Пример #17
0
        private void ConfigureDisplay()
        {
            System.Globalization.GregorianCalendar cal = new System.Globalization.GregorianCalendar();

            Facade.BusinessType       facBusinessType      = new Facade.BusinessType();
            Facade.IOrderServiceLevel facOrderServiceLevel = new Facade.Order();

            cblBusinessType.DataSource = facBusinessType.GetAll();
            cblBusinessType.DataBind();

            foreach (ListItem li in cblBusinessType.Items)
            {
                li.Selected = true;
            }

            cblServiceLevel.DataSource = facOrderServiceLevel.GetAll();
            cblServiceLevel.DataBind();

            foreach (ListItem li in cblServiceLevel.Items)
            {
                li.Selected = true;
            }

            string referencesSortExpression = Globals.Configuration.FlagForInvoicingReferencesSortExpression;

            if (!string.IsNullOrEmpty(referencesSortExpression))
            {
                grdOrders.Columns.FindByUniqueName("References").SortExpression = referencesSortExpression;
            }

            int IdentityID = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["identityid"]))
            {
                int.TryParse(Request.QueryString["identityid"].ToString(), out IdentityID);
            }

            string MinDate = string.Empty;

            if (!string.IsNullOrEmpty(Request.QueryString["MinDate"]))
            {
                MinDate = Request.QueryString["MinDate"];
            }

            if (IdentityID > 0 && MinDate.Length > 0)
            {
                m_isFromDash = true;
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(IdentityID);

                cboClient.SelectedValue = IdentityID.ToString();
                cboClient.Text          = name;

                DateTime startDate = new DateTime();
                DateTime.TryParse(MinDate, out startDate);

                rdiStartDate.SelectedDate = startDate;
                rdiEndDate.SelectedDate   = System.DateTime.Today;

                if (startDate >= System.DateTime.Today)
                {
                    rdiEndDate.SelectedDate = startDate.AddDays(1);
                }

                rdoListInvoiceType.Items[0].Selected = false;
                rdoListInvoiceType.Items[2].Selected = true;

                grdOrders.Rebind();
            }
        }
Пример #18
0
        private void PopulateStaticControls()
        {
            #region // Populate Control Areas
            Facade.IControlArea facControlArea = new Facade.Traffic();
            cboControlArea.DataSource = facControlArea.GetAll();
            cboControlArea.DataBind();
            cboControlArea.Items[0].Selected = true;
            #endregion

            #region // Populate Traffic Areas
            Facade.ITrafficArea facTrafficArea = (Facade.ITrafficArea)facControlArea;
            cboTrafficAreas.DataSource = facTrafficArea.GetAll();
            cboTrafficAreas.DataBind();
            #endregion

            #region // Populate Depots
            Facade.IOrganisationLocation facOrganisationLocation = new Facade.Organisation();
            cboDepot.DataSource = facOrganisationLocation.GetAllDepots(Orchestrator.Globals.Configuration.IdentityId);
            cboDepot.DataBind();
            cboDepot.Items.Insert(0, new ListItem("Use Control Area and Traffic Areas to determine resource pool", "0"));
            #endregion

            #region // Populate Filters for this user
            PopulateFilterList();
            #endregion

            #region // Configure the default dates.
            // Default dates are from the start of today until:
            //   1) On a Saturday, until the end of Monday.
            //   2) On any other day, until the end of tomorrow.
            DateTime startOfToday = DateTime.Now;
            startOfToday = startOfToday.Subtract(startOfToday.TimeOfDay);
            DateTime endOfTomorrow = startOfToday.Add(new TimeSpan(1, 23, 59, 59));

            DateTime startDate = startOfToday;
            DateTime endDate   = endOfTomorrow;
            if (startOfToday.DayOfWeek == DayOfWeek.Saturday)
            {
                DateTime endOfMonday = startOfToday.Add(new TimeSpan(2, 23, 59, 59));
                endDate = endOfMonday;
            }
            #endregion

            #region // Cause the job states to be displayed
            chkJobStates.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eJobState)));
            chkJobStates.DataBind();
            #endregion

            #region // Load the Job Types
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();

            cblBusinessType.DataSource     = facBusinessType.GetAll();
            cblBusinessType.DataTextField  = "Description";
            cblBusinessType.DataValueField = "BusinessTypeID";
            cblBusinessType.DataBind();
            #endregion

            #region React to supplied values

            bool haveReacted = false;

            try
            {
                Entities.TrafficSheetFilter m_trafficSheetFilter = Utilities.GetFilterFromCookie(this.CookieSessionID, Request);

                if (m_trafficSheetFilter == null)
                {
                    m_trafficSheetFilter = GetDefaultFilter();
                    m_trafficSheetFilter.FilterStartDate = startDate;
                    m_trafficSheetFilter.FilterEnddate   = endDate;
                }

                cboControlArea.ClearSelection();
                SelectItem(cboControlArea.Items, m_trafficSheetFilter.ControlAreaId);
                haveReacted = true;

                foreach (var taid in m_trafficSheetFilter.TrafficAreaIDs)
                {
                    SelectItem(cboTrafficAreas.Items, taid);
                }

                for (int i = 0; i < m_trafficSheetFilter.JobStates.Count; i++)
                {
                    chkJobStates.Items.FindByValue(Utilities.UnCamelCase(Enum.Parse(typeof(eJobState), m_trafficSheetFilter.JobStates[i].ToString()).ToString())).Selected = true;
                }

                cboDepot.ClearSelection();
                cboDepot.Items.FindByValue(m_trafficSheetFilter.DepotId.ToString()).Selected = true;
                dteStartDate.SelectedDate = m_trafficSheetFilter.FilterStartDate;
                dteEndDate.SelectedDate   = m_trafficSheetFilter.FilterEnddate;



                cblBusinessType.ClearSelection();
                foreach (int i in m_trafficSheetFilter.BusinessTypes)
                {
                    cblBusinessType.Items.FindByValue(i.ToString()).Selected = true;
                }
            }
            catch (Exception eX)
            {
                Entities.TrafficSheetFilter ts = GetDefaultFilter();
                ts.FilterStartDate        = startDate;
                dteStartDate.SelectedDate = startDate;
                ts.FilterEnddate          = endDate;
                dteEndDate.SelectedDate   = endDate;
                if (Request.Cookies[this.CookieSessionID] == null)
                {
                    SetCookie(ts);
                }

                BindDefaultFilter();
            }
            finally
            {
                // Apply the dates.
            }
            #endregion
        }
Пример #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Security.Authorise.EnforceAuthorisation(eSystemPortion.AddEditOrder);
            _exportOrderEnabled = bool.Parse(ConfigurationManager.AppSettings["ExportOrderEnabled"].ToLower());

            if (!IsPostBack)
            {
                // Show/hide the "Export to Palletforce" button depending on whether a module id is present in the config.
                btnExportOrder.Visible = _exportOrderEnabled;

                btnCreateDelivery.PostBackUrl = "DeliveryJob.aspx?" + this.CookieSessionID;

                rblDateFiltering.Items.Clear();

                // amended to remove the var so that I can deploy a hot fix
                foreach (eDateFilterType item in Enum.GetValues(typeof(eDateFilterType)))
                {
                    rblDateFiltering.Items.Add(new ListItem(Enum.GetName(typeof(eDateFilterType), item).Replace("_", " "), ((int)item).ToString()));
                }

                rblDateFiltering.Items.Add(new ListItem("Trunk Date", "3"));

                ListItem defaultDateFiltering = rblDateFiltering.Items.FindByValue(((int)C_DEFAULT_DATE_FILTERING).ToString());
                if (defaultDateFiltering != null)
                {
                    defaultDateFiltering.Selected = true;
                }
                if (rblDateFiltering.Items.Count > 0 && rblDateFiltering.SelectedItem == null)
                {
                    rblDateFiltering.Items[0].Selected = true;
                }

                Facade.ITrafficArea facTrafficArea = new Facade.Traffic();
                cblTrafficAreas.DataSource = facTrafficArea.GetAll();
                cblTrafficAreas.DataBind();

                Facade.IBusinessType facBusinessType = new Facade.BusinessType();
                DataSet dsBusinessTypes = facBusinessType.GetAll();

                cblBusinessTypes.DataSource = dsBusinessTypes;
                cblBusinessTypes.DataBind();

                foreach (DataRow row in dsBusinessTypes.Tables[0].Rows)
                {
                    RadMenuItem rmi = new RadMenuItem();
                    rmi.Text  = row["Description"].ToString();
                    rmi.Value = row["BusinessTypeID"].ToString();
                    RadMenu1.Items.Add(rmi);
                }

                Facade.IOrderServiceLevel facOrderServiceLevel = new Facade.Order();
                cblServiceLevel.DataSource = facOrderServiceLevel.GetAll();
                cblServiceLevel.DataBind();

                Facade.ExtraType facExtraType = new Facade.ExtraType();
                cblSurcharges.DataSource = facExtraType.GetAllForFiltering();
                cblSurcharges.DataBind();

                PreSelectItems(cblServiceLevel, C_SELECTED_SERVICE_LEVELS);
                PreSelectItems(cblSurcharges, C_SELECTED_SURCHARGES);

                GetDates();
            }
        }
Пример #20
0
        private void PopulateStaticControls()
        {
            #region // Configure the min and max dates.
            dteStartDate.MinDate = new DateTime(2000, 1, 1);
            dteEndDate.MaxDate   = new DateTime(2036, 12, 31);
            #endregion

            #region // Populate Control Areas
            Facade.IControlArea facControlArea = new Facade.Traffic();
            cboControlArea.DataSource = facControlArea.GetAll();
            cboControlArea.DataBind();
            cboControlArea.Items[0].Selected = true;
            #endregion

            #region // Populate Traffic Areas
            Facade.ITrafficArea facTrafficArea = (Facade.ITrafficArea)facControlArea;
            cboTrafficAreas.DataSource = facTrafficArea.GetAll();
            cboTrafficAreas.DataBind();

            if (cboTrafficAreas.Items.Count > 8)
            {
                divTrafficAreas.Attributes.Add("class", "overflowHandler");
                divTrafficAreas.Attributes.Add("style", "height:100px;");
            }
            #endregion

            #region // Populate Depots
            Facade.IOrganisationLocation facOrganisationLocation = new Facade.Organisation();
            cboDepot.DataSource = facOrganisationLocation.GetAllDepots(Orchestrator.Globals.Configuration.IdentityId);
            cboDepot.DataBind();
            cboDepot.Items.Insert(0, new ListItem("Use Control Area and Traffic Areas to determine resource pool", "0"));
            #endregion

            #region // Populate Filters for this user
            PopulateFilterList();
            #endregion

            #region // Configure the default dates.
            // Default dates are from the start of today until:
            //   1) On a Saturday, until the end of Monday.
            //   2) On any other day, until the end of tomorrow.
            DateTime startOfToday = DateTime.Now;
            startOfToday = startOfToday.Subtract(startOfToday.TimeOfDay);
            DateTime endOfTomorrow = startOfToday.Add(new TimeSpan(1, 23, 59, 59));

            DateTime startDate = startOfToday;
            DateTime endDate   = endOfTomorrow;
            if (startOfToday.DayOfWeek == DayOfWeek.Saturday)
            {
                DateTime endOfMonday = startOfToday.Add(new TimeSpan(2, 23, 59, 59));
                endDate = endOfMonday;
            }
            #endregion

            #region // Populate the Business Types
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            cblBusinessType.DataSource     = facBusinessType.GetAll();
            cblBusinessType.DataTextField  = "Description";
            cblBusinessType.DataValueField = "BusinessTypeID";
            cblBusinessType.DataBind();
            #endregion

            #region // Populate the Instruction States

            cblInstructionStates.DataSource = Enum.GetNames(typeof(eInstructionState));
            cblInstructionStates.DataBind();

            #endregion

            #region // Populate the In Progress Sub-States

            cblInProgressSubStates.DataSource = this.InProgressSubStateDescriptions.ToDictionary(kvp => (int)kvp.Key, kvp => kvp.Value);
            cblInProgressSubStates.DataBind();

            #endregion

            #region // Populate the Planning Categories Types

            cblPlanningCategory.DataSource = DataContext.PlanningCategorySet.OrderBy(pc => pc.DisplayShort);
            cblPlanningCategory.DataBind();
            var liAll = new ListItem("All", "-1")
            {
                Selected = true
            };

            cblPlanningCategory.Items.Add(liAll);

            #endregion

            #region // Populate the Instruction Types

            cblInstructionType.Items.Clear();

            var liMWF = new ListItem("MWF", "1");
            liMWF.Attributes.Add("onclick", "onInstructionTypeChecked();");
            var liNonMWF = new ListItem("Non-MWF", "2");
            liNonMWF.Attributes.Add("onclick", "onInstructionTypeChecked();");

            cblInstructionType.Items.Add(liMWF);
            cblInstructionType.Items.Add(liNonMWF);

            #endregion

            #region // Populate the MWF Comms Status

            var list = Enum.GetValues(typeof(MWFCommunicationStatusForTrafficSheetEnum)).Cast <object>().ToDictionary(v => (int)v, v => MWF_Instruction.GetCommunicationStatusForTrafficSheetDescription((int)v));

            cblMWFCommsStates.DataSource = list;
            cblMWFCommsStates.DataBind();

            #endregion

            #region // Populate the MWF Instruction States

            // Only adding the states that we use for now
            var list2 = new Dictionary <int, string>
            {
                { (int)MWFStatusEnum.Drive, "Drive" },
                { (int)MWFStatusEnum.OnSite, "On Site" },
                { (int)MWFStatusEnum.Suspend, "Suspend" },
                { (int)MWFStatusEnum.Resume, "Resume" },
                { (int)MWFStatusEnum.Complete, "Complete" }
            };

            cblMWFInstructionStates.DataSource = list2;
            cblMWFInstructionStates.DataBind();

            #endregion

            if (Filter == null)
            {
                Filter = Utilities.GetFilterFromCookie(this.CookieSessionID, Request);
            }



            if (Filter == null)
            {
                Filter = GetDefaultFilter();

                // Configure the default dates.
                // Default dates are from the start of today until:
                //   1) On a Saturday, until the end of Monday.
                //   2) On any other day, until the end of tomorrow.
                Filter.FilterStartDate = startOfToday;
                if (startOfToday.DayOfWeek == DayOfWeek.Saturday)
                {
                    DateTime endOfMonday = startOfToday.Add(new TimeSpan(2, 23, 59, 59));
                    Filter.FilterEnddate = endOfMonday;
                }
                else
                {
                    Filter.FilterEnddate = endOfTomorrow;
                }
            }


            cboControlArea.ClearSelection();
            SelectItem(cboControlArea.Items, Filter.ControlAreaId);

            foreach (var taid in Filter.TrafficAreaIDs)
            {
                SelectItem(cboTrafficAreas.Items, taid);
            }

            startDate = Filter.FilterStartDate;
            endDate   = Filter.FilterEnddate;
            chkShowPlanned.Checked           = Filter.ShowPlannedLegs;
            chkShowStockMovementJobs.Checked = Filter.ShowStockMovementJobs;

            cboDepot.ClearSelection();
            cboDepot.Items.FindByValue(Filter.DepotId.ToString()).Selected = true;

            foreach (var i in Filter.BusinessTypes)
            {
                try
                {
                    // P1 use if we try to work on different client's version of Orchestrator
                    // the same cookie is used (domain).
                    cblBusinessType.Items.FindByValue(i.ToString()).Selected = true;
                }
                catch { }
            }

            foreach (int i in this.Filter.InstructionStates)
            {
                cblInstructionStates.Items.FindByValue(((eInstructionState)i).ToString()).Selected = true;
            }

            foreach (var ipss in this.Filter.InProgressSubStates)
            {
                cblInProgressSubStates.Items.FindByValue(((int)ipss).ToString()).Selected = true;
            }

            if (this.Filter.PlanningCategories.Count > 0)
            {
                foreach (ListItem li in cblPlanningCategory.Items)
                {
                    li.Selected = this.Filter.PlanningCategories.Contains(int.Parse(li.Value));
                }
            }

            this.chkSortbyEvent.Checked  = Filter.SortbyEvent;
            this.chkCollapseRuns.Checked = this.Filter.CollapseRuns;

            liMWF.Selected    = Filter.IncludeMWFInstructions;
            liNonMWF.Selected = Filter.IncludeNonMWFInstructions;

            chkSelectAllInstructionTypes.Checked = (liMWF.Selected && liNonMWF.Selected);

            bool allSelected = false;
            if (Filter.MWFCommsStates.Count > 0)
            {
                allSelected = true;
                foreach (ListItem li in cblMWFCommsStates.Items)
                {
                    li.Selected = Filter.MWFCommsStates.Contains(int.Parse(li.Value));
                    if (!li.Selected)
                    {
                        allSelected = false;
                    }
                }
            }

            chkSelectAllMWFCommsStates.Checked = allSelected;


            var selected = false;
            if (Filter.MWFInstructionStates.Count > 0)
            {
                selected = true;
                foreach (ListItem li in cblMWFInstructionStates.Items)
                {
                    li.Selected = Filter.MWFInstructionStates.Contains(int.Parse(li.Value));
                    if (!li.Selected)
                    {
                        selected = false;
                    }
                }
            }

            chkSelectAllMWFInstructionStates.Checked = selected;


            #region     // Apply the dates.
            dteStartDate.SelectedDate = startDate;
            dteEndDate.SelectedDate   = endDate;
            #endregion
        }
        void grdOrders_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            if (IsPostBack && string.IsNullOrEmpty(Request.QueryString["rcbID"]))
            {
                // Search for orders based on Date Range Status and text
                // Determine the parameters
                List <int> orderStatusIDs = new List <int>();
                foreach (ListItem li in cblOrderStatus.Items)
                {
                    if (li.Selected)
                    {
                        orderStatusIDs.Add((int)((eOrderStatus)Enum.Parse(typeof(eOrderStatus), li.Value)));
                    }
                }

                // Retrieve the client id, resource id, and sub-contractor identity id.
                int clientID;
                int.TryParse(cboClient.SelectedValue, out clientID);
                int resourceID;
                int.TryParse(cboResource.SelectedValue, out resourceID);
                int subContractorIdentityID;
                int.TryParse(cboSubContractor.SelectedValue, out subContractorIdentityID);

                // Find the orders.
                Facade.IOrder facOrder = new Facade.Order();
                DataSet       orderData;
                try
                {
                    List <int> businessTypes = new List <int>();

                    Facade.IBusinessType facBusinessType = new Facade.BusinessType();
                    DataSet dsBusinessTypes = facBusinessType.GetAll();

                    foreach (DataRow row in dsBusinessTypes.Tables[0].Rows)
                    {
                        businessTypes.Add(Convert.ToInt32(row["BusinessTypeID"]));
                    }

                    orderData =
                        facOrder.Search(orderStatusIDs, dteStartDate.SelectedDate.Value, dteEndDate.SelectedDate.Value, txtSearch.Text,
                                        cboSearchAgainstDate.Items[0].Selected || cboSearchAgainstDate.Items[2].Selected,
                                        cboSearchAgainstDate.Items[1].Selected || cboSearchAgainstDate.Items[2].Selected,
                                        false, false, clientID, resourceID, subContractorIdentityID, businessTypes, 0, 0, 0);
                }
                catch (SqlException exc)
                {
                    if (exc.Message.StartsWith("Timeout expired."))
                    {
                        // A timeout exception has been encountered, instead of throwing the error page, instruct the user to refine their search.
                        DisplayMessage(
                            "Your query is not precise enough, please provide additional information or narrow the date/order state range.");

                        // Communicate the details of the exception to support.
                        string methodCall = "Facade.IOrder.Search('{0}', {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}); encountered by {9}";
                        Utilities.SendSupportEmailHelper(
                            string.Format(methodCall,
                                          Entities.Utilities.GetCSV(orderStatusIDs),
                                          dteStartDate.SelectedDate.Value,
                                          dteEndDate.SelectedDate.Value,
                                          txtSearch.Text,
                                          cboSearchAgainstDate.Items[0].Selected ||
                                          cboSearchAgainstDate.Items[2].Selected,
                                          cboSearchAgainstDate.Items[1].Selected ||
                                          cboSearchAgainstDate.Items[2].Selected,
                                          clientID,
                                          resourceID,
                                          subContractorIdentityID,
                                          ((Entities.CustomPrincipal)Page.User).UserName), exc);

                        orderData = null;
                    }
                    else
                    {
                        throw;
                    }
                }

                grdOrders.DataSource = orderData;
            }
        }
Пример #22
0
        //-----------------------------------------------------------------------------------------------------------

        protected void grdOrders_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            // Search for orders based on Date Range Status and text
            // Determine the parameters
            List <int> orderStatusIDs = new List <int>();

            orderStatusIDs.Add((int)eOrderStatus.Approved);
            orderStatusIDs.Add((int)eOrderStatus.Delivered);
            orderStatusIDs.Add((int)eOrderStatus.Invoiced);

            // Set the Business Types
            List <int> BusinessTypes = new List <int>();

            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            DataSet dsBusinessTypes = facBusinessType.GetAll();

            foreach (DataRow row in dsBusinessTypes.Tables[0].Rows)
            {
                BusinessTypes.Add(int.Parse(row["BusinessTypeID"].ToString()));
            }
            // Retrieve the client id, resource id, and sub-contractor identity id.
            int clientID   = 0;
            int resourceID = 0;
            int subContractorIdentityID = Globals.Configuration.PalletNetworkID;

            int collectionPointId = 0;
            int deliveryPointId   = 0;

            int goodsType = 0;

            // Find the orders.
            Facade.IOrder facOrder  = new Facade.Order();
            DataSet       orderData = null;

            try
            {
                orderData =
                    facOrder.Search(orderStatusIDs, this.dteTrunkDate.SelectedDate, this.dteTrunkDate.SelectedDate.Value.AddDays(1), String.Empty, false, false, true, false,
                                    clientID, resourceID, subContractorIdentityID, BusinessTypes, collectionPointId, deliveryPointId, goodsType);
            }
            catch (SqlException exc)
            {
                throw;
            }

            orderCount           = 0;
            totalPalletCount     = 0;
            totalPalletSpaces    = 0;
            totalWeight          = 0;
            QtrPalletsTotal      = 0;
            HalfPalletsTotal     = 0;
            FullPalletsTotal     = 0;
            OverPalletsTotal     = 0;
            OrderRateTotal       = 0;
            SubContractCostTotal = 0;
            HubChargeTotal       = 0;

            if (rboFilterOption.SelectedValue == "1")
            {
                grdOrders.DataSource = orderData;
            }
            else if (rboFilterOption.SelectedValue == "2")
            {
                DataView dv = orderData.Tables[0].DefaultView;
                dv.RowFilter         = "MessageStateId IS NOT NULL";
                grdOrders.DataSource = dv;
            }
            else
            {
                DataView dv = orderData.Tables[0].DefaultView;
                dv.RowFilter         = "MessageStateId IS NULL";
                grdOrders.DataSource = dv;
            }
        }
Пример #23
0
        //-----------------------------------------------------------------------------------------------------------

        protected void grdOrders_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            // Search for orders based on Date Range Status and text
            // Determine the parameters
            List <int> orderStatusIDs = new List <int>();

            orderStatusIDs.Add((int)eOrderStatus.Approved);
            orderStatusIDs.Add((int)eOrderStatus.Delivered);
            orderStatusIDs.Add((int)eOrderStatus.Invoiced);

            // Set the Business Types
            List <int> BusinessTypes = new List <int>();

            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            DataSet dsBusinessTypes = facBusinessType.GetAll();

            foreach (DataRow row in dsBusinessTypes.Tables[0].Rows)
            {
                BusinessTypes.Add(int.Parse(row["BusinessTypeID"].ToString()));
            }
            // Retrieve the client id, resource id, and sub-contractor identity id.
            int clientID   = 0;
            int resourceID = 0;
            int subContractorIdentityID = Globals.Configuration.PalletNetworkID;

            int collectionPointId = 0;
            int deliveryPointId   = 0;

            int goodsType = 0;

            // Find the orders.
            Facade.IOrder facOrder  = new Facade.Order();
            DataSet       orderData = null;

            try
            {
                orderData =
                    facOrder.Search(orderStatusIDs, this.dteTrunkDate.SelectedDate, this.dteTrunkDate.SelectedDate.Value.AddDays(1), String.Empty, false, false, true, false,
                                    clientID, resourceID, subContractorIdentityID, BusinessTypes, collectionPointId, deliveryPointId, goodsType);
            }
            catch (SqlException exc)
            {
                throw;
            }

            // sort out the rate to display, when none of the orders have a rate and only the order group has a rate.
            // we only want to display the rate for one order in the group.
            List <int> orderGroupIds = new List <int>();

            if (orderData != null)
            {
                orderCount           = 0;
                totalPalletCount     = 0;
                totalPalletSpaces    = 0;
                totalWeight          = 0;
                QtrPalletsTotal      = 0;
                HalfPalletsTotal     = 0;
                FullPalletsTotal     = 0;
                OverPalletsTotal     = 0;
                OrderRateTotal       = 0;
                SubContractCostTotal = 0;
                HubChargeTotal       = 0;

                foreach (DataRow row in orderData.Tables[0].Rows)
                {
                    if (row["OrderGroupId"] != System.DBNull.Value && Convert.ToDouble(row["ForeignRate"].ToString()) > 0.00)
                    {
                        if (orderGroupIds.Contains(int.Parse(row["OrderGroupId"].ToString())))
                        {
                            row["ForeignRate"] = 0.00;
                        }
                        else
                        {
                            row["ForeignRate"] = row["GroupRate"];
                            orderGroupIds.Add(int.Parse(row["OrderGroupId"].ToString()));
                        }
                    }

                    orderCount++;
                    totalPalletCount     += (int)row["NoPallets"];
                    totalPalletSpaces    += Convert.ToDouble(row["PalletSpaces"]);
                    totalWeight          += Convert.ToDouble(row["Weight"]);
                    QtrPalletsTotal      += Convert.ToDouble(row["QtrPallets"]);
                    HalfPalletsTotal     += Convert.ToDouble(row["HalfPallets"]);
                    FullPalletsTotal     += Convert.ToDouble(row["FullPallets"]);
                    OverPalletsTotal     += Convert.ToDouble(row["OverPallets"]);
                    OrderRateTotal       += (row["ForeignRate"] != DBNull.Value) ? Convert.ToDouble(row["ForeignRate"]) : 0.00;
                    SubContractCostTotal += (row["SubContractRate"] != DBNull.Value) ? Convert.ToDouble(row["SubContractRate"]) : 0.00;
                    HubChargeTotal       += (row["SubContractRate"] != DBNull.Value) ? Convert.ToDouble(row["HubCharge"]) : 0.00;
                }
            }

            grdOrders.DataSource = orderData;
        }