string HighlightSearchPanelText(string text)
    {
        ASPxGridView gridView = gv;

        DevExpress.Web.Internal.GridRenderHelper renderHelper = gridView.GetType().BaseType.GetProperty("RenderHelper",
                                                                                                        System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                                                                .GetValue(gridView) as DevExpress.Web.Internal.GridRenderHelper;
        return(renderHelper.HighlightSearchPanelText("Calculated", text, false, true, 0));
    }
Beispiel #2
0
    protected void GridSlave_BatchUpdate(object sender, DevExpress.Web.Data.ASPxDataBatchUpdateEventArgs e)
    {
        ASPxGridView grid     = (ASPxGridView)sender;
        int          route_id = int.Parse(grid.GetMasterRowKeyValue().ToString());

        foreach (var line in e.DeleteValues)
        {
            int rateid = int.Parse(line.Keys[0].ToString());
            bl.DeleteRate(rateid, route_id);
        }
        foreach (var line in e.UpdateValues)
        {
            int rate_id = int.Parse(e.UpdateValues[0].Keys["RateID"].ToString());
            var route   = bl.GetRouting(route_id);
            var rate1   = bl.GetRate(rate_id);
            var breaks  = rate1.RateDefinitionColums;
            List <RateDefinitionColum> weightBreaks = new List <RateDefinitionColum>();
            int    weightbreakid = 0;
            string Share         = line.NewValues["Share"].ToString();
            double test_share    = 0;
            if (!double.TryParse(line.NewValues["Share"].ToString(), out test_share))
            {
                ScriptManager.RegisterClientScriptBlock(grid, grid.GetType(), "ratenonum", "alert('Share must be a number!');", true);
                return;
            }

            string CarrierCode = line.NewValues["CarrierCode"].ToString();

            foreach (var br in breaks)
            {
                double test = 0;
                if (!double.TryParse(line.NewValues[br.Value].ToString(), out test))
                {
                    ScriptManager.RegisterClientScriptBlock(grid, grid.GetType(), "ratenonum", "alert('Rate must be a number!');", true);
                    return;
                }
                weightbreakid += 1;
                weightBreaks.Add(new RateDefinitionColum()
                {
                    ID = weightbreakid, Rate = line.NewValues[br.Value].ToString(), Caption = br.Caption, Value = br.Value
                });
            }
            Rate rate = new Rate()
            {
                RateID = rate_id, Share = Share, RateDefinitionColums = weightBreaks, CarrierCode = CarrierCode, RouteID = route_id
            };
            bl.UpdateRate(rate, route_id);
        }
        foreach (var line in e.InsertValues)
        {
            if (line.NewValues != null)
            {
                var route  = bl.GetRouting(route_id);
                var breaks = route.Rates[0].RateDefinitionColums;
                List <RateDefinitionColum> weightBreaks = new List <RateDefinitionColum>();
                int    weightbreakid = 0;
                string Share         = line.NewValues["Share"].ToString();

                double test_share = 0;
                if (!double.TryParse(line.NewValues["Share"].ToString(), out test_share))
                {
                    //e.e
                    ScriptManager.RegisterClientScriptBlock(grid, grid.GetType(), "ratenonum", "alert('Share must be a number!');", true);
                    return;
                }

                string CarrierCode = line.NewValues["CarrierCode"].ToString();

                foreach (var br in breaks)
                {
                    double test = 0;
                    if (!double.TryParse(line.NewValues[br.Value].ToString(), out test))
                    {
                        ScriptManager.RegisterClientScriptBlock(grid, grid.GetType(), "ratenonum", "alert('Rate must be a number!');", true);
                        return;
                    }
                    weightbreakid += 1;
                    weightBreaks.Add(new RateDefinitionColum()
                    {
                        ID = weightbreakid, Rate = line.NewValues[br.Value].ToString(), Caption = br.Caption, Value = br.Value
                    });
                }
                Rate rate = new Rate()
                {
                    RateID = bl.GetNextRateID(), Share = Share, RateDefinitionColums = weightBreaks, CarrierCode = CarrierCode, RouteID = route_id
                };
                bl.InsertRate(rate, route_id);
            }
        }
        List <RateRouting> list = bl.GetRateRoutings(elt_account_number, customer_org_num, rate_type);

        bl.SaveRateInfo(list);
        e.Handled = true;
    }