コード例 #1
0
 public void Refresh()
 {
     //Refresh the ratings cache for this instance
     try {
         this.mRates.Clear();
         this.mRates.Merge(DriverRatingFactory.GetMileageRates(this.mRatesDate, this.mAgentNumber));
         this.mRates.Merge(DriverRatingFactory.GetUnitRates(this.mRatesDate, this.mAgentNumber));
         this.mRates.Merge(DriverRatingFactory.GetMileageRouteRates(this.mRatesDate, this.mAgentNumber));
         this.mRates.Merge(DriverRatingFactory.GetUnitRouteRates(this.mRatesDate, this.mAgentNumber));
     }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while refreshing driver rates.", ex); }
 }
コード例 #2
0
        public string Export(bool updateAsExported)
        {
            //Export this driver compensation to file
            StringBuilder export = null;

            try {
                //Setup
                export = new StringBuilder();
                PayPeriod payPeriod = DriverRatingFactory.GetPayPeriod(this.mEnd);

                //Export driver compensations and admin charges
                foreach (DriverCompDS.DriverCompTableRow comp in this.mCompDS.DriverCompTable.Rows)
                {
                    if (comp.Select && comp.TotalAmount > 0)
                    {
                        //Export driver compensation
                        export.AppendLine(formatDriverRecord(payPeriod, comp));

                        //Export Admin fees if applicable
                        DriverCompDS.DriverRouteTableRow[] routes = (DriverCompDS.DriverRouteTableRow[]) this.mCompDS.DriverRouteTable.Select("AgentNumber=" + this.mAgentNumber + " AND Operator='" + comp.Operator + "'");
                        decimal adminFee = 0.0M;
                        for (int i = 0; i < routes.Length; i++)
                        {
                            adminFee += routes[i].AdminCharge;
                        }
                        if (adminFee != 0)
                        {
                            export.AppendLine(formatAdminRecord(payPeriod, comp, adminFee));
                        }

                        if (updateAsExported)
                        {
                            //Update all routes as exported
                            for (int i = 0; i < routes.Length; i++)
                            {
                                routes[i].Exported = DateTime.Today;
                                updateDriverRoute(routes[i]);
                            }
                            //RefreshDriverRoutes();
                        }
                    }
                }
                //Refresh routes if they were updated (otherwise, don't change export selections)
                if (updateAsExported)
                {
                    RefreshDriverRoutes();
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while exporting driver compensation...", ex); }
            return(export.ToString());
        }
コード例 #3
0
ファイル: ctlRates.cs プロジェクト: jpheary/Argix10
        private void OnLoad(object sender, EventArgs e)
        {
            //Event handler for control load event
            this.Cursor = Cursors.WaitCursor;
            try {
                this.grdMileageRates.Visible = this.grdUnitRates.Visible = this.grdMileageRouteRates.Visible = this.grdUnitRouteRates.Visible = false;
                #region Grid customizations from normal layout (to support cell editing)
                this.grdMileageRates.UpdateMode = UpdateMode.OnRowChangeOrLostFocus & UpdateMode.OnUpdate;
                this.grdMileageRates.DisplayLayout.Override.RowSelectors                         = Infragistics.Win.DefaultableBoolean.True;
                this.grdMileageRates.DisplayLayout.Override.RowFilterMode                        = RowFilterMode.AllRowsInBand;
                this.grdMileageRates.DisplayLayout.Override.SelectTypeRow                        = SelectType.Single;
                this.grdMileageRates.DisplayLayout.Override.SelectTypeCell                       = SelectType.Single;
                this.grdMileageRates.DisplayLayout.TabNavigation                                 = TabNavigation.NextCell;
                this.grdMileageRates.DisplayLayout.Override.AllowAddNew                          = AllowAddNew.TemplateOnBottom;
                this.grdMileageRates.DisplayLayout.Override.AllowUpdate                          = DefaultableBoolean.True;
                this.grdMileageRates.DisplayLayout.Override.AllowDelete                          = DefaultableBoolean.False;
                this.grdMileageRates.DisplayLayout.Override.MaxSelectedCells                     = 1;
                this.grdMileageRates.DisplayLayout.Override.CellClickAction                      = CellClickAction.Edit;
                this.grdMileageRates.DisplayLayout.Bands[0].Override.CellClickAction             = CellClickAction.Edit;
                this.grdMileageRates.DisplayLayout.Bands[0].Columns["AgentNumber"].SortIndicator = SortIndicator.Ascending;

                this.grdUnitRates.UpdateMode = UpdateMode.OnRowChangeOrLostFocus | UpdateMode.OnUpdate;
                this.grdUnitRates.DisplayLayout.Override.RowSelectors                         = Infragistics.Win.DefaultableBoolean.True;
                this.grdUnitRates.DisplayLayout.Override.RowFilterMode                        = RowFilterMode.AllRowsInBand;
                this.grdUnitRates.DisplayLayout.Override.SelectTypeRow                        = SelectType.Single;
                this.grdUnitRates.DisplayLayout.Override.SelectTypeCell                       = SelectType.Single;
                this.grdUnitRates.DisplayLayout.TabNavigation                                 = TabNavigation.NextCell;
                this.grdUnitRates.DisplayLayout.Override.AllowAddNew                          = AllowAddNew.TemplateOnBottom;
                this.grdUnitRates.DisplayLayout.Override.AllowUpdate                          = DefaultableBoolean.True;
                this.grdUnitRates.DisplayLayout.Override.AllowDelete                          = DefaultableBoolean.False;
                this.grdUnitRates.DisplayLayout.Override.MaxSelectedCells                     = 1;
                this.grdUnitRates.DisplayLayout.Override.CellClickAction                      = CellClickAction.Edit;
                this.grdUnitRates.DisplayLayout.Bands[0].Override.CellClickAction             = CellClickAction.Edit;
                this.grdUnitRates.DisplayLayout.Bands[0].Columns["AgentNumber"].SortIndicator = SortIndicator.Ascending;

                this.grdMileageRouteRates.UpdateMode = UpdateMode.OnRowChangeOrLostFocus | UpdateMode.OnUpdate;
                this.grdMileageRouteRates.DisplayLayout.Override.RowSelectors                         = Infragistics.Win.DefaultableBoolean.True;
                this.grdMileageRouteRates.DisplayLayout.Override.RowFilterMode                        = RowFilterMode.AllRowsInBand;
                this.grdMileageRouteRates.DisplayLayout.Override.SelectTypeRow                        = SelectType.Single;
                this.grdMileageRouteRates.DisplayLayout.Override.SelectTypeCell                       = SelectType.Single;
                this.grdMileageRouteRates.DisplayLayout.TabNavigation                                 = TabNavigation.NextCell;
                this.grdMileageRouteRates.DisplayLayout.Override.AllowAddNew                          = AllowAddNew.TemplateOnBottom;
                this.grdMileageRouteRates.DisplayLayout.Override.AllowUpdate                          = DefaultableBoolean.True;
                this.grdMileageRouteRates.DisplayLayout.Override.AllowDelete                          = DefaultableBoolean.False;
                this.grdMileageRouteRates.DisplayLayout.Override.MaxSelectedCells                     = 1;
                this.grdMileageRouteRates.DisplayLayout.Override.CellClickAction                      = CellClickAction.Edit;
                this.grdMileageRouteRates.DisplayLayout.Bands[0].Override.CellClickAction             = CellClickAction.Edit;
                this.grdMileageRouteRates.DisplayLayout.Bands[0].Columns["AgentNumber"].SortIndicator = SortIndicator.Ascending;

                this.grdUnitRouteRates.UpdateMode = UpdateMode.OnRowChangeOrLostFocus | UpdateMode.OnUpdate;
                this.grdUnitRouteRates.DisplayLayout.Override.RowSelectors                         = Infragistics.Win.DefaultableBoolean.True;
                this.grdUnitRouteRates.DisplayLayout.Override.RowFilterMode                        = RowFilterMode.AllRowsInBand;
                this.grdUnitRouteRates.DisplayLayout.Override.SelectTypeRow                        = SelectType.Single;
                this.grdUnitRouteRates.DisplayLayout.Override.SelectTypeCell                       = SelectType.Single;
                this.grdUnitRouteRates.DisplayLayout.TabNavigation                                 = TabNavigation.NextCell;
                this.grdUnitRouteRates.DisplayLayout.Override.AllowAddNew                          = AllowAddNew.TemplateOnBottom;
                this.grdUnitRouteRates.DisplayLayout.Override.AllowUpdate                          = DefaultableBoolean.True;
                this.grdUnitRouteRates.DisplayLayout.Override.AllowDelete                          = DefaultableBoolean.False;
                this.grdUnitRouteRates.DisplayLayout.Override.MaxSelectedCells                     = 1;
                this.grdUnitRouteRates.DisplayLayout.Override.CellClickAction                      = CellClickAction.Edit;
                this.grdUnitRouteRates.DisplayLayout.Bands[0].Override.CellClickAction             = CellClickAction.Edit;
                this.grdUnitRouteRates.DisplayLayout.Bands[0].Columns["AgentNumber"].SortIndicator = SortIndicator.Ascending;
                #endregion
                this.uddAgentType.DataSource    = DriverRatingFactory.EnterpriseAgents();
                this.uddAgentType.DataMember    = DriverRatingFactory.TBL_ENTERPRISEAGENTS;
                this.uddAgentType.DisplayMember = "Description";
                this.uddAgentType.ValueMember   = "AgentNumber";

                this.uddEquipType.DataSource    = DriverRatingFactory.DriverEquipmentTypes();
                this.uddEquipType.DataMember    = DriverRatingFactory.TBL_EQUIPTYPE;
                this.uddEquipType.DisplayMember = "Description";
                this.uddEquipType.ValueMember   = "ID";

                this.btnRateType.SelectedIndex = 0;
            }
            catch (Exception ex) { reportError(ex); }
            finally { this.Cursor = Cursors.Default; }
        }
コード例 #4
0
ファイル: ctlRates.cs プロジェクト: jpheary/Argix10
        private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e)
        {
            //Event handler for data entry row updated
            try {
                //There is no selected row when updating- at a cell level
                int      id = 0;
                string   agent = "", route = "", maxTrigFld = "";
                DateTime date;
                double   mile = 0.0;
                decimal  baseRate = 0.0M, rate = 0.0M;
                int      equip = 0, status = 1, maxTrigVal = 0;
                decimal  dayRate = 0.0M, tripRate = 0.0M, stopRate = 0.0M, ctnRate = 0.0M, palletRate = 0.0M, pickupCtnRate = 0.0M, minAmt = 0.0M, maxAmt = 0.0M, fsBase = 0.0M;
                switch (e.Row.Band.Key)
                {
                case "RateMileageTable":
                    id       = Convert.ToInt32(e.Row.Cells["ID"].Value);
                    agent    = e.Row.Cells["AgentNumber"].Value.ToString();
                    equip    = Convert.ToInt32(e.Row.Cells["EquipmentTypeID"].Value);
                    date     = Convert.ToDateTime(e.Row.Cells["EffectiveDate"].Value);
                    mile     = Convert.ToDouble(e.Row.Cells["Mile"].Value);
                    baseRate = Convert.ToDecimal(e.Row.Cells["BaseRate"].Value);
                    rate     = Convert.ToDecimal(e.Row.Cells["Rate"].Value);
                    if (agent.Length > 0 && equip > 0 && date > DateTime.MinValue)
                    {
                        if (e.Row.IsAddRow)
                        {
                            DriverRatingFactory.CreateMileageRate(agent, equip, date, mile, baseRate, rate);
                        }
                        else
                        {
                            DriverRatingFactory.UpdateMileageRate(id, equip, mile, baseRate, rate);
                        }
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                    break;

                case "RateUnitTable":
                    id            = Convert.ToInt32(e.Row.Cells["ID"].Value);
                    agent         = e.Row.Cells["AgentNumber"].Value.ToString();
                    equip         = Convert.ToInt32(e.Row.Cells["EquipmentTypeID"].Value);
                    date          = Convert.ToDateTime(e.Row.Cells["EffectiveDate"].Value);
                    dayRate       = Convert.ToDecimal(e.Row.Cells["DayRate"].Value);
                    tripRate      = Convert.ToDecimal(e.Row.Cells["MultiTripRate"].Value);
                    stopRate      = Convert.ToDecimal(e.Row.Cells["StopRate"].Value);
                    ctnRate       = Convert.ToDecimal(e.Row.Cells["CartonRate"].Value);
                    palletRate    = Convert.ToDecimal(e.Row.Cells["PalletRate"].Value);
                    pickupCtnRate = Convert.ToDecimal(e.Row.Cells["PickupCartonRate"].Value);
                    minAmt        = Convert.ToDecimal(e.Row.Cells["MinimumAmount"].Value);
                    maxAmt        = Convert.ToDecimal(e.Row.Cells["MaximumAmount"].Value);
                    maxTrigFld    = e.Row.Cells["MaximumTriggerField"].Value.ToString();
                    maxTrigVal    = Convert.ToInt32(e.Row.Cells["MaximumTriggerValue"].Value);
                    fsBase        = Convert.ToDecimal(e.Row.Cells["FSBase"].Value);
                    if (agent.Length > 0 && equip > 0 && date > DateTime.MinValue)
                    {
                        if (e.Row.IsAddRow)
                        {
                            DriverRatingFactory.CreateUnitRate(agent, equip, date, dayRate, tripRate, stopRate, ctnRate, palletRate, pickupCtnRate, minAmt, maxAmt, maxTrigFld, maxTrigVal, fsBase);
                        }
                        else
                        {
                            DriverRatingFactory.UpdateUnitRate(id, equip, dayRate, tripRate, stopRate, ctnRate, palletRate, pickupCtnRate, minAmt, maxAmt, maxTrigFld, maxTrigVal, fsBase);
                        }
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                    break;

                case "RateMileageRouteTable":
                    id       = Convert.ToInt32(e.Row.Cells["ID"].Value);
                    agent    = e.Row.Cells["AgentNumber"].Value.ToString();
                    route    = e.Row.Cells["Route"].Value.ToString();
                    date     = Convert.ToDateTime(e.Row.Cells["EffectiveDate"].Value);
                    mile     = Convert.ToDouble(e.Row.Cells["Mile"].Value);
                    baseRate = Convert.ToDecimal(e.Row.Cells["BaseRate"].Value);
                    rate     = Convert.ToDecimal(e.Row.Cells["Rate"].Value);
                    status   = Convert.ToInt32(e.Row.Cells["Status"].Value);
                    if (agent.Length > 0 && route.Length > 0 && date > DateTime.MinValue)
                    {
                        if (e.Row.IsAddRow)
                        {
                            DriverRatingFactory.CreateMileageRouteRate(agent, route, date, mile, baseRate, rate, status);
                        }
                        else
                        {
                            DriverRatingFactory.UpdateMileageRouteRate(id, route, mile, baseRate, rate, status);
                        }
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                    break;

                case "RateUnitRouteTable":
                    id            = Convert.ToInt32(e.Row.Cells["ID"].Value);
                    agent         = e.Row.Cells["AgentNumber"].Value.ToString();
                    route         = e.Row.Cells["Route"].Value.ToString();
                    date          = Convert.ToDateTime(e.Row.Cells["EffectiveDate"].Value);
                    dayRate       = Convert.ToDecimal(e.Row.Cells["DayRate"].Value);
                    tripRate      = Convert.ToDecimal(e.Row.Cells["MultiTripRate"].Value);
                    stopRate      = Convert.ToDecimal(e.Row.Cells["StopRate"].Value);
                    ctnRate       = Convert.ToDecimal(e.Row.Cells["CartonRate"].Value);
                    palletRate    = Convert.ToDecimal(e.Row.Cells["PalletRate"].Value);
                    pickupCtnRate = Convert.ToDecimal(e.Row.Cells["PickupCartonRate"].Value);
                    minAmt        = Convert.ToDecimal(e.Row.Cells["MinimumAmount"].Value);
                    maxAmt        = Convert.ToDecimal(e.Row.Cells["MaximumAmount"].Value);
                    maxTrigFld    = e.Row.Cells["MaximumTriggerField"].Value.ToString();
                    maxTrigVal    = Convert.ToInt32(e.Row.Cells["MaximumTriggerValue"].Value);
                    fsBase        = Convert.ToDecimal(e.Row.Cells["FSBase"].Value);
                    status        = Convert.ToInt32(e.Row.Cells["Status"].Value);
                    if (agent.Length > 0 && route.Length > 0 && date > DateTime.MinValue)
                    {
                        if (e.Row.IsAddRow)
                        {
                            DriverRatingFactory.CreateUnitRouteRate(agent, route, date, dayRate, tripRate, stopRate, ctnRate, palletRate, pickupCtnRate, minAmt, maxAmt, maxTrigFld, maxTrigVal, fsBase, status);
                        }
                        else
                        {
                            DriverRatingFactory.UpdateUnitRouteRate(id, route, dayRate, tripRate, stopRate, ctnRate, palletRate, pickupCtnRate, minAmt, maxAmt, maxTrigFld, maxTrigVal, fsBase, status);
                        }
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                    break;
                }
                this.mRates.Refresh();
            }
            catch (Exception ex) { reportError(ex); }
        }