namespace Hishop.Web.Controls
{
using Hishop.SalesManagement.Components;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Web.UI;
using System.Web.UI.WebControls; public class RegionSelector : WebControl
{============================================================== 错误区域
[CompilerGenerated]
private string <NullToDisplay>k__BackingField;
[CompilerGenerated]
private string <Separator>k__BackingField;
[CompilerGenerated]
private string <Titles>k__BackingField;
===============================================================
private int? currentRegionId;
private bool dataLoaded;
private int levelCount;
private int[] levelStack;
private string[] titleArray;错误 1 类、结构或接口成员声明中的标记“<”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 14 24 Hishop.Web.Controls
错误 2 类、结构或接口成员声明中的标记“>”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 14 38 Hishop.Web.Controls
错误 3 类、结构或接口成员声明中的标记“;”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 14 54 Hishop.Web.Controls
错误 4 类、结构或接口成员声明中的标记“<”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 16 24 Hishop.Web.Controls
错误 5 类、结构或接口成员声明中的标记“>”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 16 34 Hishop.Web.Controls
错误 6 类、结构或接口成员声明中的标记“;”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 16 50 Hishop.Web.Controls
错误 7 类、结构或接口成员声明中的标记“<”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 18 24 Hishop.Web.Controls
错误 8 类、结构或接口成员声明中的标记“>”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 18 31 Hishop.Web.Controls
错误 9 类、结构或接口成员声明中的标记“;”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 18 47 Hishop.Web.Controls
{
using Hishop.SalesManagement.Components;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Web.UI;
using System.Web.UI.WebControls; public class RegionSelector : WebControl
{============================================================== 错误区域
[CompilerGenerated]
private string <NullToDisplay>k__BackingField;
[CompilerGenerated]
private string <Separator>k__BackingField;
[CompilerGenerated]
private string <Titles>k__BackingField;
===============================================================
private int? currentRegionId;
private bool dataLoaded;
private int levelCount;
private int[] levelStack;
private string[] titleArray;错误 1 类、结构或接口成员声明中的标记“<”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 14 24 Hishop.Web.Controls
错误 2 类、结构或接口成员声明中的标记“>”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 14 38 Hishop.Web.Controls
错误 3 类、结构或接口成员声明中的标记“;”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 14 54 Hishop.Web.Controls
错误 4 类、结构或接口成员声明中的标记“<”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 16 24 Hishop.Web.Controls
错误 5 类、结构或接口成员声明中的标记“>”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 16 34 Hishop.Web.Controls
错误 6 类、结构或接口成员声明中的标记“;”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 16 50 Hishop.Web.Controls
错误 7 类、结构或接口成员声明中的标记“<”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 18 24 Hishop.Web.Controls
错误 8 类、结构或接口成员声明中的标记“>”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 18 31 Hishop.Web.Controls
错误 9 类、结构或接口成员声明中的标记“;”无效 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 18 47 Hishop.Web.Controls
private string <NullToDisplay>k__BackingField;
[CompilerGenerated]
private string <Separator>k__BackingField;
[CompilerGenerated]
private string <Titles>k__BackingField; string <Titles>,,怎么又是泛型,又是特定类型。。改下。。
问题是 private string <NullToDisplay>k__BackingField; 改为
private list<NullToDisplay>k__BackingField;
{
using Hishop.SalesManagement.Components;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Web.UI;
using System.Web.UI.WebControls; public class RegionSelector : WebControl
{ [CompilerGenerated]
private list <NullToDisplay>k__BackingField;
[CompilerGenerated]
private list <Separator>k__BackingField;
[CompilerGenerated]
private list <Titles>k__BackingField;
private int? currentRegionId;
private bool dataLoaded;
private int levelCount;
private int[] levelStack;
private string[] titleArray; public RegionSelector()
{
this.Titles = "省:| 市:| 区/县:";
this.NullToDisplay = "-请选择-";
this.Separator = ",";
} protected override void CreateChildControls()
{
this.Controls.Clear();
this.levelCount = Sales.GetMaxRegionLevel();
if (this.levelCount != 0)
{
if (!this.dataLoaded)
{
if (!string.IsNullOrEmpty(this.Context.Request.Form["regionSelectorValue"]))
{
this.currentRegionId = new int?(int.Parse(this.Context.Request.Form["regionSelectorValue"]));
}
this.dataLoaded = true;
}
this.titleArray = this.Titles.Split(new char[] { '|' });
for (int i = 0; i < this.levelCount; i++)
{
if (this.titleArray.Length > i)
{
this.Controls.Add(this.CreateTitleControl(this.titleArray[i]));
}
WebControl child = this.CreateDropDownList("ddlRegions" + i);
this.Controls.Add(child);
}
}
} private WebControl CreateDropDownList(string controlId)
{
WebControl control = new WebControl(HtmlTextWriterTag.Select);
control.Attributes.Add("id", controlId);
control.Attributes.Add("name", controlId);
control.Attributes.Add("selectset", "regions");
WebControl child = new WebControl(HtmlTextWriterTag.Option);
child.Controls.Add(new LiteralControl(this.NullToDisplay));
child.Attributes.Add("value", "");
control.Controls.Add(child);
return control;
} private WebControl CreateOption(string val, string text)
{
WebControl control = new WebControl(HtmlTextWriterTag.Option);
control.Attributes.Add("value", val);
control.Controls.Add(new LiteralControl(text));
return control;
} private Label CreateTitleControl(string title)
{
Label label = new Label();
label.Text = title;
return label;
} private void FillDropDownList(WebControl ddlRegions, IList<Hishop.SalesManagement.Components.RegionInfo> regions, int depth)
{
foreach (Hishop.SalesManagement.Components.RegionInfo info in regions)
{
WebControl child = this.CreateOption(info.RegionId.ToString(CultureInfo.InvariantCulture), info.RegionName);
if (((this.levelStack != null) && (this.levelStack.Length >= depth)) && (this.levelStack[depth - 1] == info.RegionId))
{
child.Attributes.Add("selected", "true");
}
ddlRegions.Controls.Add(child);
}
} private void GenerateLevelStack()
{
if (this.currentRegionId.HasValue && (this.currentRegionId.Value > 0))
{
Hishop.SalesManagement.Components.RegionInfo region = Sales.GetRegion(this.currentRegionId.Value);
if (region != null)
{
this.levelStack = new int[region.Depth];
if (region.Depth == 1)
{
this.levelStack[0] = this.currentRegionId.Value;
}
else
{
region.Path = region.Path.Substring(2);
region.Path = region.Path.Substring(0, region.Path.Length - 1);
string[] strArray = region.Path.Split(new char[] { ',' });
for (int i = 0; i < strArray.Length; i++)
{
this.levelStack[i] = int.Parse(strArray[i]);
}
this.levelStack[this.levelStack.Length - 1] = this.currentRegionId.Value;
}
}
}
} public int? GetSelectedRegionId()
{
if (!string.IsNullOrEmpty(this.Context.Request.Form["regionSelectorValue"]))
{
return new int?(int.Parse(this.Context.Request.Form["regionSelectorValue"]));
}
return null;
} protected override void Render(HtmlTextWriter writer)
{
if (this.levelCount > 0)
{
this.GenerateLevelStack();
this.FillDropDownList((WebControl) this.Controls[1], Sales.GetRegions(null), 1);
if (this.levelStack != null)
{
int num = 1;
for (int i = 2; i < this.Controls.Count; i++)
{
WebControl ddlRegions = this.Controls[i] as WebControl;
if (!(ddlRegions is Label) && (this.levelStack.Length >= num))
{
this.FillDropDownList(ddlRegions, Sales.GetRegions(new int?(this.levelStack[num - 1])), num + 1);
num++;
}
}
}
base.Render(writer);
writer.AddAttribute("id", "regionSelectorValue");
writer.AddAttribute("name", "regionSelectorValue");
writer.AddAttribute("value", this.currentRegionId.HasValue ? this.currentRegionId.Value.ToString(CultureInfo.InvariantCulture) : "");
writer.AddAttribute("type", "hidden");
writer.RenderBeginTag(HtmlTextWriterTag.Input);
writer.RenderEndTag();
writer.AddAttribute("id", "regionSelectorNull");
writer.AddAttribute("name", "regionSelectorNull");
writer.AddAttribute("value", this.NullToDisplay);
writer.AddAttribute("type", "hidden");
writer.RenderBeginTag(HtmlTextWriterTag.Input);
writer.RenderEndTag();
}
} public void SetSelectedRegionId(int? selectedRegionId)
{
this.currentRegionId = selectedRegionId;
this.dataLoaded = true;
} public override ControlCollection Controls
{
get
{
base.EnsureChildControls();
return base.Controls;
}
} public string NullToDisplay
{
[CompilerGenerated]
get
{
return this.<NullToDisplay>k__BackingField;
}
[CompilerGenerated]
set
{
this.<NullToDisplay>k__BackingField = value;
}
} public string SelectedRegions
{
get
{
int? selectedRegionId = this.GetSelectedRegionId();
if (!selectedRegionId.HasValue)
{
return "";
}
string str = "";
for (Hishop.SalesManagement.Components.RegionInfo info = Sales.GetRegion(selectedRegionId.Value); info != null; info = Sales.GetRegion(info.ParentId.Value))
{
str = this.Separator + info.RegionName + str;
if (!info.ParentId.HasValue)
{
break;
}
}
if (str.Length > 0)
{
str = str.Substring(1);
}
return str;
}
} public string Separator
{
[CompilerGenerated]
get
{
return this.<Separator>k__BackingField;
}
[CompilerGenerated]
set
{
this.<Separator>k__BackingField = value;
}
} public string Titles
{
[CompilerGenerated]
get
{
return this.<Titles>k__BackingField;
}
[CompilerGenerated]
set
{
this.<Titles>k__BackingField = value;
}
}
}
}
错误 21 找不到类型或命名空间名称“NullToDisplay”(是否缺少 using 指令或程序集引用?) Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 16 23 Hishop.Web.Controls
错误 22 找不到类型或命名空间名称“list”(是否缺少 using 指令或程序集引用?) Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 16 17 Hishop.Web.Controls
错误 23 找不到类型或命名空间名称“Separator”(是否缺少 using 指令或程序集引用?) Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 18 23 Hishop.Web.Controls
错误 24 找不到类型或命名空间名称“list”(是否缺少 using 指令或程序集引用?) Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 18 17 Hishop.Web.Controls
错误 25 类型“Hishop.Web.Controls.RegionSelector”已经包含“k__BackingField”的定义 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 18 33 Hishop.Web.Controls
错误 26 找不到类型或命名空间名称“Titles”(是否缺少 using 指令或程序集引用?) Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 20 23 Hishop.Web.Controls
错误 27 找不到类型或命名空间名称“list”(是否缺少 using 指令或程序集引用?) Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 20 17 Hishop.Web.Controls
错误 28 类型“Hishop.Web.Controls.RegionSelector”已经包含“k__BackingField”的定义 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 20 30 Hishop.Web.Controls
错误 59 应输入标识符 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 193 29 Hishop.Web.Controls
错误 60 应输入标识符 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 198 22 Hishop.Web.Controls
错误 61 应输入标识符 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 233 29 Hishop.Web.Controls
错误 62 应输入标识符 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 238 22 Hishop.Web.Controls
错误 63 应输入标识符 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 247 29 Hishop.Web.Controls
错误 64 应输入标识符 Q:\Hishop.Web.Controls\Hishop\Web\Controls\RegionSelector.cs 252 22 Hishop.Web.Controls