Exemplo n.º 1
0
        public RateRow(RateType RateType, int ColumCount)
        {
            this.RateType = RateType;
            Columns       = new List <RateColumn>();

            CodeListBL CodeListBL = new CodeListBL();

            for (int i = 0; i < ColumCount; i++)
            {
                var col = new RateColumn(RateType)
                {
                    Id = i + 1
                };

                if (i == 0)
                {
                    col.IsDropDown   = true;
                    col.DropDownType = ColumnDropDownType.Carrier;
                    var list = CodeListBL.GetCarrierList();
                    foreach (var item in list)
                    {
                        col.DropDownItems.Add(new SelectListItem()
                        {
                            Text = item.Text, Value = item.Value
                        });
                    }
                }

                if (i == 1 || i == 2)
                {
                    col.IsDropDown   = true;
                    col.DropDownType = ColumnDropDownType.Port;
                    var list = CodeListBL.GetPortList();
                    foreach (var item in list)
                    {
                        col.DropDownItems.Add(new SelectListItem()
                        {
                            Text = item.Text, Value = item.Value
                        });
                    }
                }
                if (i == 3)
                {
                    col.IsDropDown = true;
                }


                Columns.Add(col);
            }
        }
Exemplo n.º 2
0
        public RateHeaderRow(RateType RateType)
        {
            this.RateType = RateType;
            int ColumCount = 0;

            RateHeaderColumns = new List <RateHeaderColumn>();
            CodeListBL CodeListBL = new CodeListBL();

            if (RateType == CDT.RateType.CustomerSellingRate)
            {
                ColumCount = AppConstants.CustomerSellingRateHeaderColumCount;
            }
            if (RateType == CDT.RateType.AirLineBuyingRate)
            {
                ColumCount = AppConstants.AirLineBuyingRateHeaderColumCount;
            }
            if (RateType == CDT.RateType.AgentBuyingRate)
            {
                ColumCount = AppConstants.AgentBuyingRateHeaderColumCount;
            }
            if (RateType == CDT.RateType.IATARate)
            {
                ColumCount = AppConstants.IATARateHeaderColumnCount;
            }

            for (int i = 0; i < ColumCount; i++)
            {
                var col = new RateHeaderColumn(RateType)
                {
                    Id = i + 1
                };
                if (RateType == CDT.RateType.CustomerSellingRate)
                {
                    CreateCustomerSellingRateHeaderColums(RateType, ColumCount, CodeListBL, i, col);
                }
                if (RateType == CDT.RateType.AirLineBuyingRate)
                {
                    CreateAirlineBuyingRateHeaderColums(RateType, ColumCount, CodeListBL, i, col);
                }
                if (RateType == CDT.RateType.AgentBuyingRate)
                {
                    CreateAgentBuyingRateHeaderColums(RateType, ColumCount, CodeListBL, i, col);
                }
                if (RateType == CDT.RateType.IATARate)
                {
                    CreateIATARateHeaderColums(RateType, ColumCount, CodeListBL, i, col);
                }
            }
        }
Exemplo n.º 3
0
        private void CreateIATARateHeaderColums(RateType RateType, int ColumCount, CodeListBL CodeListBL, int i, RateHeaderColumn col)
        {
            col.Text  = "";
            col.Value = "";

            if (i == 2)
            {
                col.IsDropDown   = true;
                col.DropDownType = ColumnDropDownType.Unit;
                col.DropDownItems.Add(new SelectListItem()
                {
                    Text = "LB", Value = "L"
                });
                col.DropDownItems.Add(new SelectListItem()
                {
                    Text = "KG", Value = "K"
                });
            }

            if (i == 0 || i == 1)
            {
                col.IsDropDown   = true;
                col.DropDownType = ColumnDropDownType.Port;
                var list = CodeListBL.GetPortList();
                foreach (var item in list)
                {
                    col.DropDownItems.Add(new SelectListItem()
                    {
                        Text = item.Text, Value = item.Value
                    });
                }
            }
            if (i == 3)
            {
                col.IsMin = true;
            }
            if (i == ColumCount - 1)
            {
                col.IsProfitShare = true;
            }
            col.RateType = RateType;
            RateHeaderColumns.Add(col);
        }
Exemplo n.º 4
0
        private void GetIATARate(RateTable model)
        {
            model.RateRoutes.Clear();
            RateManagementBL   bl     = new RateManagementBL();
            List <RateRouting> routes = bl.GetRateRoutings(int.Parse(GetCurrentELTUser().elt_account_number), model.CustomerAccount, Convert.ToInt32(RateType.IATARate));

            AddMinCol(routes);

            CodeListBL BL   = new CodeListBL();
            var        list = BL.GetCarrierList();

            foreach (var route in routes)
            {
                var       info = bl.GetRouting(route.ID);
                RateRoute r    = new RateRoute(RateType.IATARate)
                {
                    RouteID = route.ID, Mode = RateRouteMode.Edit
                };
                r.RouteID = route.ID;

                r.HeaderRow.RateType = RateType.IATARate;
                int data_start_index = AppConstants.IATARateHeaderColumnStartIndex;

                r.HeaderRow.RateHeaderColumns[0].Text  = info.Origin;
                r.HeaderRow.RateHeaderColumns[1].Text  = info.Dest;
                r.HeaderRow.RateHeaderColumns[2].Text  = info.UnitText;
                r.HeaderRow.RateHeaderColumns[2].Value = info.Unit;

                bl.RefreshWeightBreakText(info.Rates[0].RateDefinitionColums);
                info.Rates[0].RateDefinitionColums = info.Rates[0].RateDefinitionColums.OrderBy(m => decimal.Parse(m.Value)).ToList();
                for (int i = 0; i < info.Rates[0].RateDefinitionColums.Count; i++)
                {
                    r.HeaderRow.RateHeaderColumns[data_start_index].Value = info.Rates[0].RateDefinitionColums[i].Value;
                    r.HeaderRow.RateHeaderColumns[data_start_index].Text  = info.Rates[0].RateDefinitionColums[i].Caption;
                    data_start_index++;
                }

                foreach (var rate in route.Rates)
                {
                    rate.RateDefinitionColums = rate.RateDefinitionColums.OrderBy(m => decimal.Parse(m.Value)).ToList();
                    data_start_index          = AppConstants.IATARateDataColumnStartIndex;

                    var data_row = new RateRow(RateType.IATARate, AppConstants.IATARateDataColumnCount);
                    data_row.RouteId = route.ID;
                    data_row.Id      = rate.RateID;

                    data_row.Columns[0].WeightBreakValueTag = "CarrierCode";
                    data_row.Columns[0].Value        = rate.CarrierCode;
                    data_row.Columns[0].Text         = (from c in list where c.Value == rate.CarrierCode select c.Text).Single();
                    data_row.Columns[0].IsDropDown   = true;
                    data_row.Columns[0].DropDownType = ColumnDropDownType.Carrier;

                    for (int i = 1; i < 2; i++)
                    {
                        data_row.Columns[i].IsDropDown = true;
                        data_row.Columns[i].IsHidden   = true;
                    }

                    foreach (var col in rate.RateDefinitionColums)
                    {
                        data_row.Columns[data_start_index].WeightBreakValueTag = col.Value;
                        data_row.Columns[data_start_index].Value = col.Rate;
                        data_row.Columns[data_start_index].Text  = col.Rate;
                        data_start_index++;
                    }
                    data_row.Columns[data_row.Columns.Count - 1].Text  = rate.Share;
                    data_row.Columns[data_row.Columns.Count - 1].Value = rate.Share;
                    data_row.Columns[data_row.Columns.Count - 1].WeightBreakValueTag = "Share";

                    r.Rows.Add(data_row);
                }
                model.RateRoutes.Add(r);
            }

            foreach (var r in model.RateRoutes)
            {
                foreach (var row in r.Rows)
                {
                    foreach (var col in row.Columns)
                    {
                        if (col.Text == null || col.Text == "")
                        {
                            if (col.Value == null || col.Value == "")
                            {
                                col.IsEmptyCell = true;
                            }
                        }
                    }
                }
            }
        }