protected void btn_Search_Click(object sender, EventArgs e) { string containerNo = boxNo.Value; string blNo = BLNo.Value; if (string.IsNullOrWhiteSpace(containerNo) && string.IsNullOrWhiteSpace(blNo)) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('箱号和提单号条件至少须输入一个!');", true); return; } QGCostcoSoapClient client = new QGCostcoSoapClient(); string errorMsg = ""; string errorCode = ""; string result = ""; string reserved = isReserved.Checked ? "Y" : "N"; result = client.reserve(containerNo, blNo, reserved, "", out errorMsg, out errorCode); if (errorCode == "0") { customsInspections = com.GetCustomsInspections(result); DataSourceList.DataSource = customsInspections.CONTAINER.Take(20); DataSourceList.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();", true); } else { DataSourceList.DataSource = null; DataSourceList.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('" + errorMsg + "');", true); } }
/****************************************************************************/ public void Load(DataSourceList aObjects) { foreach (IDataObjectSource objRow in aObjects) { this.Add(CreateObject(objRow)); } }
/// <summary> /// 根据数据源名称获得相应的DBHelper /// 若缓存中有则直接返回 /// /// </summary> /// <param name="dsName">data source name(lowcase)</param> /// <returns></returns> public static IDBHelper GetHelper(string dsName) { //If Null, init data source list first; if (DataSourceList == null) { //默认使用DBHelper.config,这里可以按需求修改为默认使用App.config XmlConfigurator.Configure("DBHelper.config"); } if (string.IsNullOrEmpty(dsName)) { dsName = "default"; } dsName = dsName.ToLower();//配置文件中dsName要小写 if (DataSourceList.ContainsKey(dsName)) { //实例化 DataSourceConfig dsConfig = DataSourceList[dsName]; string[] classNameArray = dsConfig.dialectClass.Split(new char[] { ':', '-' }); string className = classNameArray[1]; string assemblyName = classNameArray[0]; Type type = null; if (string.IsNullOrEmpty(dsConfig.dialectClass)) { throw new ArgumentNullException("配置文件错误:请检查Dialect配置"); } type = Assembly.Load(assemblyName).GetType(className, true); IDBHelper instance = Activator.CreateInstance(type, dsConfig.Parameters) as IDBHelper; return(instance); } else { throw new Exception("Not found data source [" + dsName + "], please check config file."); } }
protected void BindDataSourceList() { ViewState["id"] = null; int i, j; string SourceName = txtSourceName.Text.Trim(); ViewState["txtSourceName"] = SourceName; string SourceIP = txtSourceIP.Text.Trim(); ViewState["txtSourceIP"] = SourceIP; string DBName = txtDBName.Text.Trim(); ViewState["txtDBName"] = DBName; string ObjectType = ""; if (!string.IsNullOrWhiteSpace(hidisdefault.Value)) { ObjectType = (ddlDataType.SelectedValue == "all" ? "" : ddlDataType.SelectedValue); } ViewState["ddlDataType"] = ObjectType; string ObjectName = txtObjectName.Text; ViewState["txtObjectName"] = ObjectName; string SourceStatus = ""; if (!string.IsNullOrWhiteSpace(hidisdefault.Value)) { SourceStatus = (ddlStatus.SelectedValue == "all" ? "" : ddlStatus.SelectedValue); } ViewState["ddlStatus"] = SourceStatus; int startIndex = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int PageSize = AspNetPager1.PageSize; string bigcate = (ddlCATEGORY.SelectedValue == "all" ? "" : ddlCATEGORY.SelectedValue); ViewState["ddlCATEGORY"] = bigcate; string smallcate = (ddlsmallcategory.SelectedValue == "all" ? "" : ddlsmallcategory.SelectedValue); ViewState["ddlsmallcategory"] = smallcate; DataSourceConfigComponent tmbll = new DataSourceConfigComponent(); DataTable dt = tmbll.GetDataSourceList(SourceName, SourceIP, DBName, ObjectType, ObjectName, SourceStatus, bigcate, smallcate, "", AspNetPager1.CurrentPageIndex, PageSize, out i, out j); AspNetPager1.RecordCount = i; DataSourceList.DataSource = dt; DataSourceList.DataBind(); if (dt == null || dt.Rows.Count == 0) { lblnodata.Visible = true; } else { lblnodata.Visible = false; } ReCodePager(); //ViewState["TemplateList"] = dt; }
public void AddOrUpdateDataSource(string key, DesignerDataSource ds) { if (DataSourceList.Keys.Contains(key)) { DataSourceList[key] = ds; } else { DataSourceList.Add(key, ds); } }
public void RemoveDataSource(string key) { if (DataSourceList.Keys.Contains(key)) { DataSourceList.Remove(key); } else { return; } }
/************************************************************************/ public static IList <T> ToList <T>(this DataTable table, bool dispose = true) where T : new() { DataSourceList dataSource = DataSourceList.Create(table); IList <T> list = dataSource.ToList <T>(); if (dispose) { table.Dispose(); } return(list); }
public override void RefreshSecondaryData() { _clases = ClaseAuditoriaList.GetList(false); Library.Quality.HComboBoxSourceList combo_clases = new Library.Quality.HComboBoxSourceList(_clases, false); Datos_ComboClases.DataSource = combo_clases; Bar.Grow(); _tipos = TipoAuditoriaList.GetList(); combo_clases.Childs = new Library.Quality.HComboBoxSourceList(_tipos); Bar.Grow(); _source_list = new DataSourceList(combo_clases); Datos_ComboClases.DataSource = _source_list.CBList; Bar.Grow(); }
protected void BindDataSourceList() { int i, j; string SourceName = txtSourceName.Text.Trim(); string SourceIP = txtSourceIP.Text.Trim(); string DBName = txtDBName.Text.Trim(); string ObjectType = ddlDataType.SelectedValue; string ObjectName = txtObjectName.Text; int startIndex = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int PageSize = AspNetPager1.PageSize; DataSourceConfigComponent tmbll = new DataSourceConfigComponent(); DataTable dt = tmbll.GetDataSourceList(SourceName, SourceIP, DBName, ObjectType, ObjectName, "", AspNetPager1.CurrentPageIndex, PageSize, out i, out j); AspNetPager1.RecordCount = i; DataSourceList.DataSource = dt; DataSourceList.DataBind(); }
public override void RefreshSecondaryData() { _productos = ProductList.GetList(false); _series = SerieList.GetList(false, ETipoSerie.Compra); _modulos = ModuloList.GetList(false); Library.Instruction.HComboBoxSourceList comboModulosT = new Library.Instruction.HComboBoxSourceList(_modulos); Library.Instruction.HComboBoxSourceList comboModulosP = new Library.Instruction.HComboBoxSourceList(_modulos); PgMng.Grow(); _submodulos = SubmoduloList.GetList(false); comboModulosT.Childs = new Library.Instruction.HComboBoxSourceList(_submodulos); comboModulosP.Childs = new Library.Instruction.HComboBoxSourceList(_submodulos); PgMng.Grow(); _source_list = new DataSourceList(comboModulosT); Datos_Modulos.DataSource = _source_list.CBList; PgMng.Grow(); }
protected void BindDataSourceListByOrderBy(string orderby) { int i, j; string SourceName = (ViewState["txtSourceName"] == null?txtSourceName.Text.Trim():ViewState["txtSourceName"].ToString()); string SourceIP = (ViewState["txtSourceIP"] == null?txtSourceIP.Text.Trim():ViewState["txtSourceIP"].ToString()); string DBName = (ViewState["txtDBName"] == null?txtDBName.Text.Trim():ViewState["txtDBName"].ToString()); string ObjectType = (ViewState["ddlDataType"] == null?ddlDataType.SelectedValue:ViewState["ddlDataType"].ToString()); string ObjectName = (ViewState["txtObjectName"] == null?txtObjectName.Text.Trim():ViewState["txtObjectName"].ToString()); string SourceStatus = (ViewState["ddlStatus"] == null?ddlStatus.SelectedValue:ViewState["ddlStatus"].ToString()); int startIndex = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int PageSize = AspNetPager1.PageSize; string bigcate = (ViewState["ddlCATEGORY"] == null?ddlCATEGORY.SelectedValue:ViewState["ddlCATEGORY"].ToString()); string smallcate = (ViewState["ddlsmallcategory"] == null?ddlsmallcategory.SelectedValue:ViewState["ddlsmallcategory"].ToString()); DataSourceConfigComponent tmbll = new DataSourceConfigComponent(); DataTable dt = tmbll.GetDataSourceList(SourceName, SourceIP, DBName, ObjectType, ObjectName, SourceStatus, bigcate, smallcate, orderby, AspNetPager1.CurrentPageIndex, PageSize, out i, out j); AspNetPager1.RecordCount = i; DataSourceList.DataSource = dt; DataSourceList.DataBind(); //ViewState["TemplateList"] = dt; ReCodePager(); }
protected void BindDataSourceList() { try { AspNetPager1.PageSize = Convert.ToInt32(hidpagesize.Value); int recordCount; string pageName = txtPageName.Text.Trim(); string useCompany = txtUseCompany.Text.Trim(); string creater = txtCreater.Text.Trim(); int startIndex = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int PageSize = AspNetPager1.PageSize; RightsManagementComponent rightBll = new RightsManagementComponent(); DataTable dt = rightBll.GetAllPages(SPContext.Current.Site.Url, out recordCount, pageName, useCompany, creater, AspNetPager1.CurrentPageIndex, PageSize); ViewState["AuthorationDataSource"] = dt; if (recordCount == 0) { lblnodata.Visible = true; } else { lblnodata.Visible = false; } AspNetPager1.CurrentPageIndex = 1; AspNetPager1.RecordCount = recordCount; DataSourceList.DataSource = dt; DataSourceList.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "setAllsel", "BindSelectAllEvent();", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "setsel", "BindEachCboEvent();", true); } catch (Exception ex) { BaseComponent.Error("授权首页数据绑定: " + ex.Message + "--------" + ex.StackTrace); } }
public void Mondo_Common_IDataObjectSource_ToList() { string xml = "<Data><Car><Make>Aston Martin</Make><Model>DB9</Model><Year>1965</Year><Color>Blue</Color></Car><Car><Make>Audi</Make><Model>A4</Model><Year>1973</Year><Color>Green</Color></Car></Data>"; XmlDocument xmlDoc = XmlDoc.LoadXml(xml); DataSourceList ds = DataSourceList.Create(xmlDoc); IList <TestClass2> list = ds.ToList <TestClass2>(); TestClass2 obj = list[0]; Assert.AreEqual("Aston Martin", obj.Make); Assert.AreEqual("DB9", obj.Model); Assert.AreEqual(1965, obj.Year); Assert.AreEqual("Blue", obj.Color); Assert.AreEqual(false, obj.NumDoors.HasValue); obj = list[1]; Assert.AreEqual("Audi", obj.Make); Assert.AreEqual("A4", obj.Model); Assert.AreEqual(1973, obj.Year); Assert.AreEqual("Green", obj.Color); Assert.AreEqual(false, obj.NumDoors.HasValue); }
public override void RefreshSecondaryData() { _productos = ProductList.GetList(false); _series = SerieList.GetList(false, ETipoSerie.Compra); _modulos = ModuloList.GetList(false); Library.Instruction.HComboBoxSourceList comboModulosT = new Library.Instruction.HComboBoxSourceList(_modulos); Library.Instruction.HComboBoxSourceList comboModulosP = new Library.Instruction.HComboBoxSourceList(_modulos); PgMng.Grow(); _submodulos = SubmoduloList.GetList(false); comboModulosT.Childs = new Library.Instruction.HComboBoxSourceList(_submodulos); comboModulosP.Childs = new Library.Instruction.HComboBoxSourceList(_submodulos); PgMng.Grow(); _source_list_t = new DataSourceList(comboModulosT); _source_list_p = new DataSourceList(comboModulosP); Datos_Modulos.DataSource = _source_list_t.CBList; PgMng.Grow(); Library.Instruction.HComboBoxSourceList _incompatibles = new Library.Instruction.HComboBoxSourceList(); ComboBoxSource _compatible = new ComboBoxSource(0, ""); ComboBoxSource _inc_1 = new ComboBoxSource(1, "1"); ComboBoxSource _inc_2 = new ComboBoxSource(2, "2"); ComboBoxSource _inc_3 = new ComboBoxSource(3, "3"); ComboBoxSource _inc_4 = new ComboBoxSource(4, "4"); ComboBoxSource _inc_5 = new ComboBoxSource(5, "5"); _incompatibles.Add(_compatible); _incompatibles.Add(_inc_1); _incompatibles.Add(_inc_2); _incompatibles.Add(_inc_3); _incompatibles.Add(_inc_4); _incompatibles.Add(_inc_5); Datos_Incompatible.DataSource = _incompatibles; PgMng.Grow(); }
IEnumerator <T> IEnumerable <T> .GetEnumerator() { return(DataSourceList.GetEnumerator()); }
/****************************************************************************/ public ObjectDictionary(DataSourceList aObjects) : base(127) { Load(aObjects); }
protected void btn_Search_Click(object sender, EventArgs e) { string containerNo = boxNo.Value; string blNo = BLNo.Value; if (string.IsNullOrWhiteSpace(containerNo) && string.IsNullOrWhiteSpace(blNo)) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('请输入正确的箱号或提单号!');", true); return; } QGCostcoSoapClient client = new QGCostcoSoapClient(); string errorMsg = ""; string errorCode = ""; string result = ""; //string reserved = isReserved.Checked ? "Y" : "N"; string reserved = "Y"; result = client.reserve(containerNo, blNo, reserved, "", out errorMsg, out errorCode); BaseComponent.Info("WebService Paras reserve Y:containerNo " + containerNo + ";blNo " + blNo + ";reserved " + reserved + ";errorMsg " + errorMsg + ";errorCode " + errorCode); customsInspections = null; if (errorCode == "0") { customsInspections = com.GetCustomsInspections(result); //if (isReserved.Checked) if (customsInspections != null && customsInspections.CONTAINER.Count > 0) { DataSourceList.Visible = false; DataSourceList2.Visible = true; DataSourceList2.DataSource = customsInspections.CONTAINER; DataSourceList2.DataBind(); } else { DataSourceList.Visible = false; DataSourceList2.Visible = true; DataSourceList2.DataSource = null; DataSourceList2.DataBind(); } //if (customsInspections != null && customsInspections.CONTAINER.Count > 0 && !string.IsNullOrWhiteSpace(blNo) && string.IsNullOrWhiteSpace(containerNo) && !string.IsNullOrWhiteSpace(inspectionTime.Value) && !isReserved.Checked) if (customsInspections != null && customsInspections.CONTAINER.Count > 0 && reserved == "N") { btn_Booking.Visible = true; } else { btn_Booking.Visible = false; } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();", true); } else { reserved = "N"; result = client.reserve(containerNo, blNo, reserved, "", out errorMsg, out errorCode); BaseComponent.Info("WebService Paras reserve N:containerNo " + containerNo + ";blNo " + blNo + ";reserved " + reserved + ";errorMsg " + errorMsg + ";errorCode " + errorCode); customsInspections = null; if (errorCode == "0") { customsInspections = com.GetCustomsInspections(result); if (customsInspections != null && customsInspections.CONTAINER.Count > 0) { DataSourceList.Visible = true; DataSourceList2.Visible = false; DataSourceList.DataSource = customsInspections.CONTAINER; DataSourceList.DataBind(); } else { DataSourceList.Visible = true; DataSourceList2.Visible = false; DataSourceList.DataSource = null; DataSourceList.DataBind(); } if (customsInspections != null && customsInspections.CONTAINER.Count > 0) { btn_Booking.Visible = true; } else { btn_Booking.Visible = false; } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsucclose", "layer.closeAll();", true); } else { if (reserved == "N") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();layer.alert('如果无法查询出数据,请在“海关查验进度查询”中查看是否已经预约');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();layer.alert('" + errorMsg + "');", true); } btn_Booking.Visible = false; DataSourceList.DataSource = null; DataSourceList.DataBind(); DataSourceList2.DataSource = null; DataSourceList2.DataBind(); } //if (reserved == "N") // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();layer.alert('如果无法查询出数据,请在“海关查验进度查询”中查看是否已经预约');", true); //else // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.closeAll();layer.alert('" + errorMsg + "');", true); //btn_Booking.Visible = false; //DataSourceList.DataSource = null; //DataSourceList.DataBind(); //DataSourceList2.DataSource = null; //DataSourceList2.DataBind(); } }
public void RemoveAt(int index) { DataSourceList.RemoveAt(index); }
public bool Remove(T item) { return(DataSourceList.Remove(item)); }
public void Insert(int index, T item) { DataSourceList.Insert(index, item); }
public void Add(T item) { DataSourceList.Add(item); }
public void CopyTo(T[] array, int arrayIndex) { DataSourceList.CopyTo(array, arrayIndex); }
public bool Contains(T item) { return(DataSourceList.Contains(item)); }
public void Clear() { DataSourceList.Clear(); }
public int IndexOf(T item) { return(DataSourceList.IndexOf(item)); }
protected void DataSourceList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { if (e.Item.ItemType == ListItemType.Header) { LinkButton lkbtnSort = (LinkButton)e.Item.FindControl(e.CommandName.Trim()); if (ViewState[e.CommandName.Trim()] == null) { ViewState[e.CommandName.Trim()] = "ASC"; lkbtnSort.Text = lkbtnSort.Text + "▲"; } else { if (ViewState[e.CommandName.Trim()].ToString().Trim() == "ASC") { ViewState[e.CommandName.Trim()] = "DESC"; if (lkbtnSort.Text.IndexOf("▲") != -1) { lkbtnSort.Text = lkbtnSort.Text.Replace("▲", "▼"); } else { lkbtnSort.Text = lkbtnSort.Text + "▼"; } } else { ViewState[e.CommandName.Trim()] = "ASC"; if (lkbtnSort.Text.IndexOf("▼") != -1) { lkbtnSort.Text = lkbtnSort.Text.Trim().Replace("▼", "▲"); } else { lkbtnSort.Text = lkbtnSort.Text + "▲"; } } } ViewState["text"] = lkbtnSort.Text; ViewState["id"] = e.CommandName.Trim(); string orderby = e.CommandName.ToString().Trim() + " " + ViewState[e.CommandName.Trim()].ToString().Trim(); if (ViewState["AuthorationDataSource"] == null) { BindDataSourceList(); } else { DataTable dtSource = (DataTable)ViewState["AuthorationDataSource"]; if (dtSource != null || dtSource.Rows.Count > 0) { DataView view = dtSource.DefaultView; view.Sort = orderby; DataTable dtResult = view.ToTable(); AspNetPager1.CurrentPageIndex = 1; AspNetPager1.RecordCount = dtResult.Rows.Count; DataSourceList.DataSource = dtResult; DataSourceList.DataBind(); } } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "setvsel", "layer.closeAll();", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "setAllsel", "BindSelectAllEvent();", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "setsel", "BindEachCboEvent();", true); } }