private void Edit(int filter_id) { DataRow dr = ProfileMetric.GetThreshold(filter_id); if (dr != null) { ltfilter_displayname.Text = dr["threshold_filter_displayname"].ToString(); txtfilter_ytd.Text = dr["threshold_filter_ytd"].ToString(); txtfilter_yoy.Text = dr["threshold_filter_yoy"].ToString(); if (dr["threshold_filter_ytd_operator"] != System.DBNull.Value && ddlfilter_ytd_operator.Items.FindByValue(dr["threshold_filter_ytd_operator"].ToString()) != null) { ddlfilter_ytd_operator.SelectedValue = dr["threshold_filter_ytd_operator"].ToString(); } if (dr["threshold_filter_yoy_operator"] != System.DBNull.Value && ddlfilter_yoy_operator.Items.FindByValue(dr["threshold_filter_yoy_operator"].ToString()) != null) { ddlfilter_yoy_operator.SelectedValue = dr["threshold_filter_yoy_operator"].ToString(); } } ViewState["edit_filter_id"] = filter_id; pnlAddEdit.Visible = true; }
ProfileMetric Profile1() { DateTime startTime = DateTime.UtcNow; for (int i = 0; i < iterations; i++) { var applicator = new BindingApplicator(); var bindingExpression = new BindingExpression { //Converter = "BooleanToVisibilityConverter", //ConverterParameter = "Visible,Hidden,Hidden", Path = nameof(ViewModelTestClass.Bool1), Target = nameof(ViewTestClass.Bool1) }; var target = new ViewTestClass(); var source = new ViewModelTestClass(); applicator.ApplyBinding(bindingExpression, target, source); } DateTime endTime = DateTime.UtcNow; var duration = endTime - startTime; var metric = new ProfileMetric(); metric.Name = "Simple"; metric.TimeSpan = new TimeSpan(duration.Ticks / iterations); return(metric); }
ProfileMetric Profile2() { DateTime startTime = DateTime.UtcNow; var path = nameof(ViewModelTestClass.NestedClass1) + "." + "Bool2"; for (int i = 0; i < iterations; i++) { var applicator = new BindingApplicator(); var bindingExpression = new BindingExpression { Path = path, Target = nameof(ViewTestClass.Bool1) }; var target = new ViewTestClass(); var source = new ViewModelTestClass(); applicator.ApplyBinding(bindingExpression, target, source); } DateTime endTime = DateTime.UtcNow; var duration = endTime - startTime; var metric = new ProfileMetric(); metric.Name = "Nested"; metric.TimeSpan = new TimeSpan(duration.Ticks / iterations); return(metric); }
ProfileMetric Profile3() { var converter = new DummyBooleanToVisibilityConverter(); DateTime startTime = DateTime.UtcNow; for (int i = 0; i < iterations; i++) { var applicator = new BindingApplicator(); var bindingExpression = new BindingExpression { Path = nameof(ViewModelTestClass.Bool1), Target = nameof(ViewTestClass.Visibility), //Converter = "Codon.UI.Data.DummyBooleanToVisibilityConverter, Codon.ApiProfiling" }; var target = new ViewTestClass(); var source = new ViewModelTestClass(); applicator.ApplyBinding(bindingExpression, target, source, converter); } DateTime endTime = DateTime.UtcNow; var duration = endTime - startTime; var metric = new ProfileMetric(); metric.Name = "Converter"; metric.TimeSpan = new TimeSpan(duration.Ticks / iterations); return(metric); }
private void InitMetricFilters() { //added checkboxes to treeview - BW, 4/15/2012. Literal list; string listItem = ""; List <ProfileMetric> metriclist = ProfileMetric.InitMetricList(); var listOfUls = new List <string>(); foreach (ProfileMetric pm in metriclist) { foreach (ProfileMetric.MetricThreshold mt in pm.thresholds) { /*CheckBox chk = new CheckBox(); * chk.ID = "chk" + pm.columnname + ((int)mt.ThresholdType).ToString(); * chk.Attributes.Add("threshold", mt.ToString()); * chk.Attributes.Add("onclick", "ReDraw('" + ddlMSA.ClientID + "')"); * //chk.Style.Add("margin", "5px"); * * chk.Text = "";*/ string chkbox = "<span threshold=\"" + mt.ToString() + "\"><input type='checkbox' onclick=\"ReDraw('" + ddlMSA.ClientID + "')\" id=\"ContentPlaceHolder1_chk" + pm.columnname + ((int)mt.ThresholdType).ToString() + "\" name=\"ContentPlaceHolder1_chk" + pm.columnname + ((int)mt.ThresholdType).ToString() + "\"></span>"; var lt = new Literal(); var thrstr = (mt.ThresholdType == ProfileMetric.MetricThreshold.ThresholdTypes.InControl) ? string.Empty : "(" + mt.Threshold.ToString("0.00") + ")"; var editlnk = (mt.ThresholdType == ProfileMetric.MetricThreshold.ThresholdTypes.InControl) ? string.Empty : "<a href=\"ManageThresholdUsers.aspx?redirect=GoogleMap.aspx&edit_filter_id=" + pm.thresholdid + "\">Edit</a>"; lt.Text = "<span style=\"font-size:12px;\">" + pm.displayname + " (" + mt.ThresholdType.ToString() + ") " + thrstr + " " + editlnk + "</span>"; //Change this line for Master Page listItem += "<li><span>" + chkbox + " " + lt.Text + "</span></li>"; //Following was the original code //dvDropDowns.Controls.Add(chk); //dvDropDowns.Controls.Add(lt); //dvDropDowns.Controls.Add(new System.Web.UI.HtmlControls.HtmlGenericControl("br")); } listOfUls.Add("<li class='expandable'><span style=\"font-size:12px;\">" + pm.columnname + "</span><ul>" + listItem + "</ul></li>"); listItem = ""; } string liText = ""; foreach (var listOfUl in listOfUls) { //liText += "<li class='collapsable'> " + listOfUl + " </li>"; liText += listOfUl; } list = new Literal { Text = "<ul id='browser' class='treeview'>" + liText + "</ul><br/>" }; dvDropDowns.Controls.Add(list); }
/// <summary> /// Creates a new profile. /// </summary> public Profile(string name, ProfileMetric metric, string[] vehicleTypes, Constraint[] constrainedVariables, Vehicle parent, Func <IAttributeCollection, FactorAndSpeed> custom) { _name = name; _metric = metric; _vehicleTypes = vehicleTypes; _constrainedVariables = constrainedVariables; _parent = parent; _custom = custom; }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { if (ViewState["edit_filter_id"] != null && (int)ViewState["edit_filter_id"] > 0) { DataRow dr = ProfileMetric.GetThreshold((int)ViewState["edit_filter_id"]); if (dr != null) { if (dr != null) { if (txtfilter_ytd.Text == string.Empty) { dr["threshold_filter_ytd"] = System.DBNull.Value; } else { dr["threshold_filter_ytd"] = decimal.Parse(txtfilter_ytd.Text); } if (txtfilter_yoy.Text == string.Empty) { dr["threshold_filter_yoy"] = System.DBNull.Value; } else { dr["threshold_filter_yoy"] = decimal.Parse(txtfilter_yoy.Text); } dr["threshold_filter_ytd_operator"] = int.Parse(ddlfilter_ytd_operator.SelectedValue); dr["threshold_filter_yoy_operator"] = int.Parse(ddlfilter_yoy_operator.SelectedValue); } dr.AcceptChanges(); } ltMessage.Text = "Threshold update successful"; } else { ltMessage.Text = "Error occurred while saving changes"; } if (ViewState["redirect"] != null) { Response.Redirect(ViewState["redirect"].ToString()); } else { Clear(); BindGrid(); } } }
protected void gvThresholds_RowDeleting(object sender, GridViewDeleteEventArgs e) { if (e.Keys.Count > 0) { int filter_id = (int)e.Keys[0]; ProfileMetric.DeleteThreshold(filter_id); BindGrid(); ltMessage.Text = "Threshold delete successful"; } }
/// <summary> /// Gets the weight for the given metric. /// </summary> public static float GetForMetric(this Weight weight, ProfileMetric metric) { switch (metric) { case ProfileMetric.TimeInSeconds: return weight.Time; case ProfileMetric.DistanceInMeters: return weight.Distance; } return weight.Value; }
public Profile(string name, Func <TagsCollectionBase, Speed> getSpeed, Func <Speed> minSpeed, Func <TagsCollectionBase, bool> canStop, Func <TagsCollectionBase, TagsCollectionBase, bool> equals, List <string> vehicleTypes, Func <TagsCollectionBase, Factor> getFactor) { this._minSpeed = minSpeed; this._getSpeed = getSpeed; this._canStop = canStop; this._equals = equals; this._vehicleTypes = vehicleTypes; this._name = name; this._metric = ProfileMetric.Custom; this._getFactor = getFactor; }
/// <summary> /// Creates a new dynamic profile. /// </summary> internal DynamicProfile(string name, ProfileMetric metric, string[] vehicleTypes, DynamicVehicle parent, Script script, object factor_and_speed) : base(name, metric, vehicleTypes, null, parent) { _name = name; _metric = metric; _vehicleTypes = vehicleTypes; _script = script; _function = factor_and_speed; _attributesTable = new Table(_script); _resultsTable = new Table(_script); }
/// <summary> /// Gets the weight for the given metric. /// </summary> public float GetForMetric(ProfileMetric metric) { switch (metric) { case ProfileMetric.TimeInSeconds: return(this.Time); case ProfileMetric.DistanceInMeters: return(this.Distance); } return(this.Value); }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { decimal?threshold_filter_ytd = null; decimal?threshold_filter_yoy = null; if (txtfilter_ytd.Text != string.Empty) { threshold_filter_ytd = decimal.Parse(txtfilter_ytd.Text); } if (txtfilter_yoy.Text != string.Empty) { threshold_filter_yoy = decimal.Parse(txtfilter_yoy.Text); } if (ViewState["edit_filter_id"] == null) { ProfileMetric.InsertThreshold(txtfilter_desc.Text , txtfilter_displayname.Text , threshold_filter_ytd , threshold_filter_yoy , chkfilter_percentage.Checked , ddlfilter_formatstring.SelectedValue , int.Parse(ddlfilter_ytd_operator.SelectedValue) , int.Parse(ddlfilter_yoy_operator.SelectedValue)); ltMessage.Text = "Threshold addition successful"; } else if (ViewState["edit_filter_id"] != null && (int)ViewState["edit_filter_id"] > 0) { ProfileMetric.UpdateThreshold((int)ViewState["edit_filter_id"] , txtfilter_desc.Text , txtfilter_displayname.Text , threshold_filter_ytd , threshold_filter_yoy , chkfilter_percentage.Checked , ddlfilter_formatstring.SelectedValue , int.Parse(ddlfilter_ytd_operator.SelectedValue) , int.Parse(ddlfilter_yoy_operator.SelectedValue)); ltMessage.Text = "Threshold update successful"; } else { ltMessage.Text = "Error Occurred Saving changes"; } Clear(); BindGrid(); } }
/// <summary> /// Creates a new routing profile. /// </summary> public Profile(string name, Func <IAttributeCollection, Speed> getSpeed, Func <Speed> minSpeed, Func <IAttributeCollection, bool> canStop, Func <IAttributeCollection, IAttributeCollection, bool> equals, List <string> vehicleTypes, Func <IAttributeCollection, Factor> getFactor, ProfileMetric metric = ProfileMetric.Custom) { _minSpeed = minSpeed; _getSpeed = getSpeed; _canStop = canStop; _equals = equals; _vehicleTypes = vehicleTypes; _name = name; _metric = metric; _getFactor = getFactor; }
public static DataRow GetThreshold(int filter_id) { DataSet ds = ProfileMetric.GetThresholdData(true); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows.Find(filter_id); return(dr); } return(null); }
public Profile(string name, Func <TagsCollectionBase, Speed> getSpeed, Func <Speed> minSpeed, Func <TagsCollectionBase, bool> canStop, Func <TagsCollectionBase, TagsCollectionBase, bool> equals, List <string> vehicleTypes, ProfileMetric metric) { if (metric == ProfileMetric.Custom) { throw new ArgumentException("Cannot set a custom metric without a getFactor function."); } this._minSpeed = minSpeed; this._getSpeed = getSpeed; this._canStop = canStop; this._equals = equals; this._vehicleTypes = vehicleTypes; this._name = name; this._metric = metric; this._getFactor = (Func <TagsCollectionBase, Factor>)null; }
/// <summary> /// Creates a new routing profile. /// </summary> public Profile(string name, Func <IAttributeCollection, Speed> getSpeed, Func <Speed> minSpeed, Func <IAttributeCollection, bool> canStop, Func <IAttributeCollection, IAttributeCollection, bool> equals, List <string> vehicleTypes, ProfileMetric metric) { if (metric == ProfileMetric.Custom) { throw new ArgumentException("Cannot set a custom metric without a getFactor function."); } _minSpeed = minSpeed; _getSpeed = getSpeed; _canStop = canStop; _equals = equals; _vehicleTypes = vehicleTypes; _name = name; _metric = metric; _getFactor = null; }
public static List <ProfileMetric> InitMetricList() { List <ProfileMetric> lst = new List <ProfileMetric>(); DataSet ds = GetThresholdData(true); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { string colname = (dr["threshold_filter_desc"] == System.DBNull.Value) ? "Filter" + dr["threshold_filter_id"].ToString() : dr["threshold_filter_desc"].ToString(); string dispname = (dr["threshold_filter_displayname"] == System.DBNull.Value) ? "Filter " + dr["threshold_filter_id"].ToString() : dr["threshold_filter_displayname"].ToString(); bool perc = (bool)dr["threshold_filter_percentage"]; ProfileMetric pm = new ProfileMetric((int)dr["threshold_filter_id"], colname, dispname, perc); pm.displayformatstring = dr["threshold_filter_formatstring"].ToString().Trim(); if (dr["threshold_filter_ytd"] != System.DBNull.Value) { pm.thresholds.Add(new MetricThreshold(decimal.Parse(dr["threshold_filter_ytd"].ToString()) , MetricThreshold.ThresholdTypes.YTD , (int.Parse(dr["threshold_filter_ytd_operator"].ToString()) == 1) ? MetricThreshold.ThresholdOperatorTypes.GTE : MetricThreshold.ThresholdOperatorTypes.LTE)); } if (dr["threshold_filter_yoy"] != System.DBNull.Value) { pm.thresholds.Add(new MetricThreshold(decimal.Parse(dr["threshold_filter_yoy"].ToString()) , MetricThreshold.ThresholdTypes.YoY , (int.Parse(dr["threshold_filter_yoy_operator"].ToString()) == 1) ? MetricThreshold.ThresholdOperatorTypes.GTE : MetricThreshold.ThresholdOperatorTypes.LTE)); } // InControl is last in the loop for ProfileMetric pm list pm.thresholds.Add(new MetricThreshold(0.0m , MetricThreshold.ThresholdTypes.InControl , MetricThreshold.ThresholdOperatorTypes.LTE)); lst.Add(pm); } } return(lst); }
protected void gvThresholds_RowEditing(object sender, GridViewEditEventArgs e) { int filter_id = (int)gvThresholds.DataKeys[e.NewEditIndex].Value; DataRow dr = ProfileMetric.GetThreshold(filter_id); if (dr != null) { txtfilter_desc.Text = dr["threshold_filter_desc"].ToString(); txtfilter_displayname.Text = dr["threshold_filter_displayname"].ToString(); txtfilter_ytd.Text = dr["threshold_filter_ytd"].ToString(); txtfilter_yoy.Text = dr["threshold_filter_yoy"].ToString(); if (ddlfilter_formatstring.Items.FindByValue(dr["threshold_filter_formatstring"].ToString()) != null) { ddlfilter_formatstring.SelectedValue = dr["threshold_filter_formatstring"].ToString(); } chkfilter_percentage.Checked = (dr["threshold_filter_percentage"] != System.DBNull.Value && (bool)dr["threshold_filter_percentage"] == true); if (dr["threshold_filter_ytd_operator"] != System.DBNull.Value && ddlfilter_ytd_operator.Items.FindByValue(dr["threshold_filter_ytd_operator"].ToString()) != null) { ddlfilter_ytd_operator.SelectedValue = dr["threshold_filter_ytd_operator"].ToString(); } if (dr["threshold_filter_yoy_operator"] != System.DBNull.Value && ddlfilter_yoy_operator.Items.FindByValue(dr["threshold_filter_yoy_operator"].ToString()) != null) { ddlfilter_yoy_operator.SelectedValue = dr["threshold_filter_yoy_operator"].ToString(); } } ViewState["edit_filter_id"] = filter_id; e.Cancel = true; btnSave.Text = "Save Threshold"; }
/// <summary> /// Inserts the given customer at the best location if possible. /// </summary> /// <param name="tour">The tour to insert into.</param> /// <param name="weights">The directed weights.</param> /// <param name="turnPenalties">The turn pentalties.</param> /// <param name="customer">The customer to insert.</param> /// <param name="metric">The metric to use, time, distance or custom.</param> /// <param name="max">The maximum allowed cost of the insertion.</param> public static Weight InsertCheapestDirected(this Tour tour, Weight[][] weights, Weight[] turnPenalties, ProfileMetric metric, int customer, Weight max) { if (tour.Count == 1) { // there is only one customer, the first one in the route. if (tour.First == tour.Last) { // there is one customer but it's both the start and the end. var firstId = DirectedHelper.ExtractId(tour.First); var bestCost = new Weight() { Distance = float.MaxValue, Time = float.MaxValue, Value = float.MaxValue }; var bestDirected1Id = int.MaxValue; var bestDirected2Id = int.MaxValue; for (var turn1 = 0; turn1 < 4; turn1++) { var firstDirectedId = DirectedHelper.BuildDirectedId(firstId, turn1); var firstArrivalId = DirectedHelper.ExtractArrivalId(firstDirectedId); var firstDepartureId = DirectedHelper.ExtractDepartureId(firstDirectedId); for (var turn2 = 0; turn2 < 4; turn2++) { var customerDirectedId = DirectedHelper.BuildDirectedId(customer, turn2); var customerArrivalId = DirectedHelper.ExtractArrivalId(customerDirectedId); var customerDepartureId = DirectedHelper.ExtractDepartureId(customerDirectedId); var weight = turnPenalties[turn1]; weight += turnPenalties[turn2]; weight += weights[firstDepartureId][customerArrivalId]; weight += weights[customerDepartureId][firstArrivalId]; if (bestCost.GetForMetric(metric) > weight.GetForMetric(metric)) { bestDirected1Id = firstDirectedId; bestDirected2Id = customerDirectedId; bestCost = weight; } } } if (bestCost.GetForMetric(metric) <= max.GetForMetric(metric)) { tour.Replace(tour.First, bestDirected1Id); tour.InsertAfter(tour.First, bestDirected2Id); return bestCost; } } else { // there is one customer, the last one is not set. var firstId = DirectedHelper.ExtractId(tour.First); int departureOffset1, arrivalOffset2; var cost = DirectedHelper.CheapestInsert(weights, turnPenalties, firstId, customer, metric, out departureOffset1, out arrivalOffset2); if (cost.GetForMetric(metric) <= max.GetForMetric(metric)) { var newFirst = DirectedHelper.UpdateDepartureOffset( DirectedHelper.BuildDirectedId(firstId, 0), departureOffset1); var customerDirectedId = DirectedHelper.UpdateArrivalOffset( DirectedHelper.BuildDirectedId(customer, 0), arrivalOffset2); tour.Replace(tour.First, newFirst); tour.InsertAfter(tour.First, customerDirectedId); return cost; } } } else { // at least 2 customers already exist, insert a new one in between. var cost = Weight.MaxValue; var departureOffsetFrom = Constants.NOT_SET; var arrivalOffsetTo = Constants.NOT_SET; var turn = Constants.NOT_SET; var location = new Pair(int.MaxValue, int.MaxValue); foreach (var pair in tour.Pairs()) { int departureOffset1, arrivalOffset3, turn2; var fromIsFirst = tour.IsFirst(pair.From); var toIsLast = tour.IsLast(pair.To); var localCost = CheapestInsertionDirectedHelper.CalculateCheapestInsert(weights, turnPenalties, metric, pair.From, customer, pair.To, !fromIsFirst, !toIsLast, out departureOffset1, out arrivalOffset3, out turn2); if (localCost.GetForMetric(metric) < cost.GetForMetric(metric)) { cost = localCost; location = pair; departureOffsetFrom = departureOffset1; arrivalOffsetTo = arrivalOffset3; turn = turn2; } } if (cost.GetForMetric(metric) <= max.GetForMetric(metric)) { var directedId = DirectedHelper.BuildDirectedId(customer, turn); tour.InsertAfter(location.From, directedId); // update departure offset at from. var newFromId = DirectedHelper.UpdateDepartureOffset(location.From, departureOffsetFrom); if (location.From != newFromId) { tour.Replace(location.From, newFromId); } var newToId = DirectedHelper.UpdateArrivalOffset(location.To, arrivalOffsetTo); if (location.To != newToId) { tour.Replace(location.To, newToId); } return cost; } } return Weight.Zero; // insert failed, probably costs are too high (above given max parameter). }
private void GenerateMap() { DataSet ds = GetTopProviders(); if (ds != null && ds.Tables.Count > 0) { List <LatLong> lst = new List <LatLong>(); foreach (DataRowView dr in ds.Tables[0].DefaultView) { StringBuilder sb = new StringBuilder(); sb.Append((dr["Address1"] != null) ? Server.UrlEncode(dr["Address1"].ToString().ToUpper()) : string.Empty); //sb.Append((dr["Address2"] != null) ? Server.UrlEncode(dr["Address2"].ToString().ToUpper()) : string.Empty); sb.Append((dr["City"] != null && dr["City"].ToString() != string.Empty) ? ",+" + Server.UrlEncode(dr["City"].ToString().ToUpper()) : string.Empty); sb.Append((dr["State"] != null && dr["State"].ToString() != string.Empty) ? ",+" + Server.UrlEncode(dr["State"].ToString().ToUpper()) : string.Empty); string name = (dr["Provider"] != null) ? dr["Provider"].ToString().ToUpper() : string.Empty; string phone = (dr["Phone"] != null) ? dr["Phone"].ToString() : string.Empty; string tin = (dr["TIN9"] != null) ? dr["TIN9"].ToString() : string.Empty; string suffix = (dr["SUFFIX"] != null) ? dr["SUFFIX"].ToString() : string.Empty; string icon = _iconGreen; string msa = (dr["MSA"] != null) ? dr["MSA"].ToString() : string.Empty; string currentyear = (dr["Current_Year"] != null) ? dr["Current_Year"].ToString() : string.Empty; string previousyear = (dr["Previous_Year"] != null) ? dr["Previous_Year"].ToString() : string.Empty; string lat = (dr["lat"] != null) ? dr["lat"].ToString() : string.Empty; string lng = (dr["long"] != null) ? dr["long"].ToString() : string.Empty; bool contracted = false; if (dr["Contracted"] != System.DBNull.Value) { bool.TryParse(dr["Contracted"].ToString(), out contracted); } //Currently Thresholds are hardcoded into ProfileMetric.cs class under App_Code //If they are coming from class, it could be set here //If anything not in control, icon is red //Thresholds: List <ProfileMetric> metriclist = ProfileMetric.InitMetricList(); ProfileMetric.UpdateMetricWithData(metriclist, ds.Tables[0], dr.Row); //Not needed as per the new business logic /*foreach (ProfileMetric pm in metriclist) * { * //If any of the Metrics is not in control, icon is red * if (pm.incontrol.HasValue && pm.incontrol.Value == false) * { * icon = _iconRed; * } * }*/ LatLong latlng = new LatLong(tin, suffix, lat, lng, name, Server.UrlDecode(sb.ToString()), phone, msa, icon, contracted, currentyear, previousyear); if (latlng.Lat != string.Empty && latlng.Lng != string.Empty) { latlng.MetricList = metriclist; lst.Add(latlng); } } System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string sJSON = oSerializer.Serialize(lst); if (lst.Count > 0) { ltinitmap.Text = "<script language=\"javascript\" type=\"text/javascript\">var latlngarr = " + sJSON + ";</script>" + Environment.NewLine; ltinitmap.Text += string.Format("<script language=\"javascript\" type=\"text/javascript\">var map = initialize(latlngarr);</script>"); } else { //daily query limit can trigger this else condition ltinitmap.Text = "<script language=\"javascript\" type=\"text/javascript\">alert('No Providers Found');</script>"; } } }
private void BindGrid() { gvThresholds.DataSource = ProfileMetric.GetThresholdData(false); //sets values to current user session or database gvThresholds.DataBind(); }
/// <summary> /// Creates a new profile. /// </summary> public Profile(string name, ProfileMetric metric, string[] vehicleTypes, Constraint[] constrainedVariables, Vehicle parent) : this(name, metric, vehicleTypes, constrainedVariables, parent, null) { }
/// <summary> /// Gets the minimum weight from customer1 -> customer2 while inserting customer2. Outputs the best departure and arrival offsets. /// </summary> public static Weight CheapestInsert(this Weight[][] weights, Weight[] penalties, int id1, int id2, ProfileMetric metric, out int departureOffset1, out int arrivalOffset2) { var best = Itinero.Algorithms.Weights.Weight.MaxValue; var base1 = id1 * 2; var base2 = id2 * 2; departureOffset1 = -1; arrivalOffset2 = -1; for (var do1 = 0; do1 < 2; do1++) { var departureId1 = base1 + do1; for (var ao2 = 0; ao2 < 2; ao2++) { var arrivalId2 = base2 + ao2; var weight = weights[departureId1][arrivalId2]; if (weight.GetForMetric(metric) < best.GetForMetric(metric)) { departureOffset1 = do1; arrivalOffset2 = ao2; best = weight; } } } return(best); }
/// <summary> /// Gets the minimum weight from customer1 -> customer3 while inserting customer2 and the best direction and turns to use. /// </summary> public static Weight CalculateCheapestInsert(this Weight[][] weights, Weight[] penalties, ProfileMetric metric, int directedId1, int id2, int directedId3, bool includeTurn1, bool includeTurn3, out int departureOffset1, out int arrivalOffset3, out int turn2) { // extract existing data. int id1, turn1, arrivalId1, departureId1, arrivalOffset1, temp; DirectedHelper.ExtractAll(directedId1, out arrivalId1, out departureId1, out id1, out turn1); DirectedHelper.ExtractOffset(turn1, out arrivalOffset1, out temp); int id3, turn3, arrivalId3, departureId3, departureOffset3; DirectedHelper.ExtractAll(directedId3, out arrivalId3, out departureId3, out id3, out turn3); DirectedHelper.ExtractOffset(turn3, out temp, out departureOffset3); // calculate current weight. var weightBefore = weights[departureId1][arrivalId3]; if (includeTurn1) { weightBefore += penalties[turn1]; } if (includeTurn3) { weightBefore += penalties[turn3]; } // evaluate all possibilities. var best = Weight.MaxValue; var base1 = id1 * 2; var base2 = id2 * 2; var base3 = id3 * 2; departureOffset1 = Constants.NOT_SET; arrivalOffset3 = Constants.NOT_SET; turn2 = Constants.NOT_SET; for (var do1 = 0; do1 < 2; do1++) { var d1 = base1 + do1; var turn1Weight = Weight.Zero; if (includeTurn1) { turn1 = DirectedHelper.BuildTurn(arrivalOffset1, do1); turn1Weight = penalties[turn1]; } for (var ao3 = 0; ao3 < 2; ao3++) { var a3 = base3 + ao3; var turn3Weight = Weight.Zero; if (includeTurn3) { turn3 = DirectedHelper.BuildTurn(departureOffset3, ao3); turn3Weight = penalties[turn3]; } for (var t = 0; t < 4; t++) { int ao2, do2; DirectedHelper.ExtractOffset(t, out ao2, out do2); var weight = weights[d1][base2 + ao2] + weights[base2 + do2][a3] + penalties[t] + turn1Weight + turn3Weight; if (weight.GetForMetric(metric) < best.GetForMetric(metric)) { best = weight; departureOffset1 = do1; arrivalOffset3 = ao3; turn2 = t; } } } } return best - weightBefore; }