private void BindLotteryMaintenanceNavigation() { //notes: set up collection of list items ListItemCollection navigationList = new ListItemCollection(); //notes: set local variables and set default values bool isLotteryLookupLinkable = true; string lotteryLookupQueryString = string.Empty; switch (this.CurrentNavigationLink) { case LotteryMaintenanceNavigation.LotteryLookup: isLotteryLookupLinkable = false; break; } //notes: add each item to the collection navigationList.Add(new ListItem { Text = "Lottery Game Lookup", Value = "/LotteryMaintenance/Default/aspx", Enabled = isLotteryLookupLinkable }); //notes: bind list object to front-end control LotteryMaintenanceNavigationList.DataSource = navigationList; LotteryMaintenanceNavigationList.DataBind(); }
// Writes the text of each bullet according to the list's display mode. protected virtual void RenderBulletText (ListItemCollection items, int index, HtmlTextWriter writer) { switch (Control.DisplayMode) { case BulletedListDisplayMode.Text: writer.WriteEncodedText(items[index].Text); writer.WriteBreak(); break; case BulletedListDisplayMode.HyperLink: // string targetURL = Control.ResolveClientUrl(items[index].Value); if (items[index].Enabled) { PageAdapter.RenderBeginHyperlink(writer, targetURL, true /* encode */, items[index].Text); writer.Write(items[index].Text); PageAdapter.RenderEndHyperlink(writer); } else { writer.WriteEncodedText(items[index].Text); } writer.WriteBreak(); break; case BulletedListDisplayMode.LinkButton: if (items[index].Enabled) { // PageAdapter.RenderPostBackEvent(writer, Control.UniqueID, index.ToString(CultureInfo.InvariantCulture), items[index].Text, items[index].Text); } else { writer.WriteEncodedText(items[index].Text); } writer.WriteBreak(); break; default: Debug.Assert(false, "Invalid BulletedListDisplayMode"); break; } }
public static void LoadListItems(System.Web.UI.WebControls.ListItemCollection list, IDataReader rdr, string textField, string valField, string selectedValue, bool closeReader) { ListItem l; string sText = ""; string sVal = ""; list.Clear(); while (rdr.Read()) { sText = rdr[textField].ToString(); sVal = rdr[valField].ToString(); l = new ListItem(sText, sVal); if (selectedValue != string.Empty) { if (selectedValue.ToLower() == sVal.ToLower()) { l.Selected = true; } } list.Add(l); } if (closeReader) { rdr.Close(); } }
public static ListItemCollection BuildListFromEnum(Enum objEnum) { ListItemCollection colListItems = new ListItemCollection(); ListItem liItem; SortedList colSortedListItems = new SortedList(); foreach (int value in Enum.GetValues(objEnum.GetType())) { liItem = new ListItem(); liItem.Value = value.ToString(); liItem.Text = StringEnum.GetStringValue((Enum)Enum.Parse(objEnum.GetType(), value.ToString(), true)); if (liItem.Text != string.Empty) { colSortedListItems.Add(liItem.Text, liItem); } liItem = null; } foreach (ListItem liListItem in colSortedListItems.GetValueList()) { colListItems.Add(liListItem); } return colListItems; }
private void @__BuildControl__control5(System.Web.UI.WebControls.ListItemCollection @__ctrl) { global::System.Web.UI.WebControls.ListItem @__ctrl1; @__ctrl1 = this.@__BuildControl__control6(); @__ctrl.Add(@__ctrl1); global::System.Web.UI.WebControls.ListItem @__ctrl2; @__ctrl2 = this.@__BuildControl__control7(); @__ctrl.Add(@__ctrl2); global::System.Web.UI.WebControls.ListItem @__ctrl3; @__ctrl3 = this.@__BuildControl__control8(); @__ctrl.Add(@__ctrl3); global::System.Web.UI.WebControls.ListItem @__ctrl4; @__ctrl4 = this.@__BuildControl__control9(); @__ctrl.Add(@__ctrl4); global::System.Web.UI.WebControls.ListItem @__ctrl5; @__ctrl5 = this.@__BuildControl__control10(); @__ctrl.Add(@__ctrl5); global::System.Web.UI.WebControls.ListItem @__ctrl6; @__ctrl6 = this.@__BuildControl__control11(); @__ctrl.Add(@__ctrl6); global::System.Web.UI.WebControls.ListItem @__ctrl7; @__ctrl7 = this.@__BuildControl__control12(); @__ctrl.Add(@__ctrl7); global::System.Web.UI.WebControls.ListItem @__ctrl8; @__ctrl8 = this.@__BuildControl__control13(); @__ctrl.Add(@__ctrl8); global::System.Web.UI.WebControls.ListItem @__ctrl9; @__ctrl9 = this.@__BuildControl__control14(); @__ctrl.Add(@__ctrl9); global::System.Web.UI.WebControls.ListItem @__ctrl10; @__ctrl10 = this.@__BuildControl__control15(); @__ctrl.Add(@__ctrl10); }
public static void Build(System.Web.UI.WebControls.ListItemCollection items, AlertConst alertConst) { items.Clear(); items.Add(new ListItem(alertConst.GetName(AlertLevel_Old.Severity), AlertLevel_Old.Severity)); items.Add(new ListItem(alertConst.GetName(AlertLevel_Old.Important), AlertLevel_Old.Important)); items.Add(new ListItem(alertConst.GetName(AlertLevel_Old.Primary), AlertLevel_Old.Primary)); }
protected void AddTradeItems(int TradeId, int TeamId, ListItemCollection List) { foreach (ListItem i in List) { if (i.Selected) { int Id = int.Parse(i.Value.Substring(1)); int PlayerId = -1; int PickId = -1; if (i.Value.ToCharArray()[0] == 'd') { PickId = Id; } else { PlayerId = Id; } int DontCare = (int)SqlHelper.ExecuteScalar( System.Configuration.ConfigurationManager.AppSettings["ConnectionString"], "spAddTradeItem", TradeId, TeamId, PickId, PlayerId ); } } }
public static void SelectSingleListItem(ListItemCollection items, string val) { foreach(ListItem itm in items) if(itm.Value == val) itm.Selected = true; else itm.Selected = false; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataSet ds = objTransferPackageTimings.GetAllTrasferpackageDescription(int.Parse(Request.QueryString["ID"].ToString())); GridView1.DataSource = ds; GridView1.DataBind(); foreach (GridViewRow item in GridView1.Rows) { Label lblfromTOid = (Label)item.FindControl("lbltp_detialid"); Label lblFlag = (Label)item.FindControl("lblFlag"); DDL1 = (MulticheckDropdown)item.FindControl("DDL1"); DataSet ds1 = objTransferPackageTimings.GetAallTimings(); //DataSet DsMealDate = objHotelStoreProcedure.getALLdateFORmEAL(txtpty_CheckIn.Text, txtpty_CheckOut.Text); ListItemCollection list = new ListItemCollection(); for (int i1 = 0; i1 < ds1.Tables[0].Rows.Count; i1++) { ListItem listitem = new ListItem(Convert.ToString(ds1.Tables[0].Rows[i1]["TIME"]), Convert.ToString(ds1.Tables[0].Rows[i1]["TIME"])); list.Add(listitem); } DDC1.DDList.DataSource = list; DDC1.DDList.DataTextField = "Text"; DDC1.DDList.DataValueField = "Value"; DDC1.DDList.DataBind(); DataSet ds11 = objTransferPackageTimings.GetAllTrasferpackageTimmings(int.Parse(lblfromTOid.Text), lblFlag.Text, "SIC"); if (ds11.Tables[0].Rows.Count != 0) { ListItemCollection list2 = new ListItemCollection(); for (int j = 0; j < ds11.Tables[0].Rows.Count; j++) { for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { if (ds1.Tables[0].Rows[i]["TIME"].ToString() == ds11.Tables[0].Rows[j]["AutoSearchResult"].ToString()) { setchk = setchk + "," + Convert.ToString(ds11.Tables[0].Rows[j]["AutoSearchResult"].ToString()); } } } setchk = setchk.Substring(1); DDC1.SetCheckBoxValues(setchk); setchk = ""; } } } }
/// <summary> /// Initializes a new instance of the <see cref="ExtendedListItemCollection"/> class. /// </summary> /// <param name="wrappedCollection">The wrapped collection.</param> public ExtendedListItemCollection(ListItemCollection wrappedCollection) { if (null == wrappedCollection) { throw new ArgumentNullException("wrappedCollection"); } this._wrappedCollection = wrappedCollection; }
public static void Build(System.Web.UI.WebControls.ListItemCollection items, AlertConst alertConst) { items.Clear(); items.Add(new ListItem(alertConst.GetName(AlertStatus_Old.Unhandled), AlertStatus_Old.Unhandled)); items.Add(new ListItem(alertConst.GetName(AlertStatus_Old.Observing), AlertStatus_Old.Observing)); items.Add(new ListItem(alertConst.GetName(AlertStatus_Old.Handling), AlertStatus_Old.Handling)); items.Add(new ListItem(alertConst.GetName(AlertStatus_Old.Closed), AlertStatus_Old.Closed)); }
public static void BindListItem(ListItemCollection LIC, DataView DataSource, string TextField, string ValueField) { LIC.Clear(); for (int i = 0; i < DataSource.Count; i++) { LIC.Add(new ListItem(DataSource[i][TextField].ToString(), DataSource[i][ValueField].ToString())); } }
public AtribucionesUsuario(string usuario,string TipoUsuario,string UserId) { this.usuario = usuario; this.tipoUsuario = TipoUsuario; this.userId = UserId; propiedades = new ListItemCollection(); }
private void @__BuildControl__control2(System.Web.UI.WebControls.ListItemCollection @__ctrl) { global::System.Web.UI.WebControls.ListItem @__ctrl1; @__ctrl1 = this.@__BuildControl__control3(); @__ctrl.Add(@__ctrl1); global::System.Web.UI.WebControls.ListItem @__ctrl2; @__ctrl2 = this.@__BuildControl__control4(); @__ctrl.Add(@__ctrl2); }
/// <summary> /// Initializes the datasource /// </summary> /// <param name="datasource"></param> protected override void InitializeDataSource(System.Web.UI.WebControls.ListItemCollection datasource) { String msg2 = AppLogic.GetString("setvatsetting.aspx.3", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); String msg3 = AppLogic.GetString("setvatsetting.aspx.4", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); datasource.Add(new ListItem(msg2, ((int)VATSettingEnum.ShowPricesInclusiveOfVAT).ToString())); datasource.Add(new ListItem(msg3, ((int)VATSettingEnum.ShowPricesExclusiveOfVAT).ToString())); this.SelectedValue = ((int)ThisCustomer.VATSettingRAW).ToString(); }
protected void llenaCombo() { System.Web.UI.WebControls.ListItemCollection cboitems = new System.Web.UI.WebControls.ListItemCollection(); System.Web.UI.WebControls.ListItem[] li = new System.Web.UI.WebControls.ListItem[cmbRol.Items.Count]; cmbRol.Items.CopyTo(li, 0); cboitems.AddRange(li); cboitems.RemoveAt(1); creaCombo(cboitems, "cboRol", 0, out HTMLCboRol); }
public static void SetListSelection(System.Web.UI.WebControls.ListItemCollection lc, string Selection) { for (int i = 0; i < lc.Count; i++) { if (lc[i].Value == Selection) { lc[i].Selected = true; break; } } }
private void BindingPages() { var pages = db.Pages.Where(t => t.ParentId == -1).ToList(); ListItemCollection list = new ListItemCollection(); GetListPages(pages, ref list, 0); ddlPages.DataSource = list; ddlPages.DataTextField = "Text"; ddlPages.DataValueField = "Value"; ddlPages.DataBind(); ddlPages.Items.Insert(0, new ListItem("-None-", "-1")); }
public static ListItemCollection GetFontFamilies() { var col = new ListItemCollection { new ListItem("Arial", "Arial"), new ListItem("Verdana", "Verdana"), new ListItem("Lucida Sans", "Lucida Sans"), new ListItem("Calibri", "Calibri"), new ListItem("Trebuchet MS", "Trebuchet MS") }; return col; }
public static List<string> GetSelectedValues(System.Web.UI.WebControls.ListItemCollection lic) { List<string> selectedItems = new List<string>(); foreach (System.Web.UI.WebControls.ListItem li in lic) { if (li.Selected) { selectedItems.Add(li.Value); } } return selectedItems; }
public static List<int> GetSelectedValuesInt(System.Web.UI.WebControls.ListItemCollection lic) { List<int> selectedItems = new List<int>(); foreach (System.Web.UI.WebControls.ListItem li in lic) { if (li.Selected) { selectedItems.Add(int.Parse(li.Value)); } } return selectedItems; }
//绑定学期标识下拉列表 public void DataBindSearchTermTagList(ListItemCollection itemCollection) { DalOperationAboutCourses doac = new DalOperationAboutCourses(); DataTable dt = doac.FindAllTermTags().Tables[0]; string termTag = null; for (int i = 0; i < dt.Rows.Count; i++) { termTag = dt.Rows[i]["termTag"].ToString().Trim(); ListItem li = new ListItem(CommonUtility.ChangeTermToString(termTag), termTag); itemCollection.Add(li); } }
private void BindLotteryNavigation() { ListItemCollection navigationList = new ListItemCollection(); bool isBasicInfo = true; bool isDrawing = true; bool isWinningNumber = true; bool isState = true; bool isWin = true; string lotteryIdQueryString = "LotteryId=" + this.LotteryGameId.ToString(); if (this.LotteryGameId > 0) { switch (this.CurrentNavigationLink) { case LotteryNavigation.LotteryBasic: isBasicInfo = false; break; case LotteryNavigation.Drawing: isDrawing = false; break; case LotteryNavigation.WinningNumber: isWinningNumber = false; break; case LotteryNavigation.State: isState = false; break; case LotteryNavigation.Win: isWin = false; break; } } else { isBasicInfo = false; isDrawing = false; isWinningNumber = false; isState = false; isWin = false; } navigationList.Add(new ListItem { Text = "Basic Info", Value ="/LotterySection/LotteryBasic.aspx?" + lotteryIdQueryString, Enabled = isBasicInfo }); navigationList.Add(new ListItem { Text = "Drawing", Value = "/LotterySection/Drawing.aspx?" + lotteryIdQueryString, Enabled = isDrawing }); navigationList.Add(new ListItem { Text = "Winning Numbers", Value = "/LotterySection/WinningNumber.aspx?" + lotteryIdQueryString, Enabled = isWinningNumber }); navigationList.Add(new ListItem { Text = "State", Value = "/LotterySection/State.aspx?" + lotteryIdQueryString, Enabled = isState }); navigationList.Add(new ListItem { Text = "Win", Value = "/LotterySection/Win.aspx?" + lotteryIdQueryString, Enabled = isWin }); LotteryNavigationList.DataSource = navigationList; LotteryNavigationList.DataBind(); }
public void LoadStatusList2DDL(string selected_value) { ListItemCollection lstColl = new ListItemCollection(); lstColl.Add(new ListItem("Active", "1")); lstColl.Add(new ListItem("InActive", "0")); rdlDiscontinued.DataSource = lstColl; rdlDiscontinued.DataTextField = "Text"; rdlDiscontinued.DataValueField = "Value"; rdlDiscontinued.DataBind(); rdlDiscontinued.SelectedValue = selected_value; }
protected void llenaCombo() { System.Web.UI.WebControls.ListItemCollection cboitems = new System.Web.UI.WebControls.ListItemCollection(); System.Web.UI.WebControls.ListItem[] li = new System.Web.UI.WebControls.ListItem[cmbCalidad.Items.Count]; cmbCalidad.Items.CopyTo(li, 0); cboitems.AddRange(li); cboitems.RemoveAt(1); creaCombo(cboitems, "CboCalidad1", 0, out HTMLCboCalidad1); creaCombo(cboitems, "CboCalidad2", 0, out HTMLCboCalidad2); creaCombo(cboitems, "CboCalidad3", 0, out HTMLCboCalidad3); creaCombo(cboitems, "CboCalidad4", 0, out HTMLCboCalidad4); }
public void PopulateIsSecureList2DDL() { ListItemCollection lstColl = new ListItemCollection(); lstColl.Add(new ListItem("Admin Menu", "True")); lstColl.Add(new ListItem("Front Menu", "False")); ddlIsSecure.DataSource = lstColl; ddlIsSecure.DataTextField = "Text"; ddlIsSecure.DataValueField = "Value"; ddlIsSecure.DataBind(); ddlIsSecure.SelectedIndex = 0; // Select the first item ddlIsSecure.AutoPostBack = true; }
public static void FillToListBox(ListItemCollection lstItems, DataTable source, int rootId, bool superUser) { DataRow[] drCommands = source.Select("CommandParentID = " + rootId); foreach(DataRow row in drCommands) { if (!superUser && (bool)row["IsSuperUser"]) continue; ListItem rootItem = new ListItem(row["CommandName"].ToString(), row["CommandID"].ToString()); rootItem.Attributes.Add("Level","0"); lstItems.Add(rootItem); LoadForCurListItem(lstItems, rootItem, source, superUser); } lstItems.Insert(0, new ListItem("Root","0")); }
public static ListItemCollection CreateListCollectionOfNumbers(int Low, int High) { ListItemCollection colNumbersList = new ListItemCollection(); for (int i = Low; i <= High; i++) { string strNumber = i.ToString(); ListItem objNumberItem = new ListItem(strNumber, strNumber); colNumbersList.Add(objNumberItem); } return colNumbersList; }
protected void LoadControlTypeList2DDL() { ListItemCollection lstColl = new ListItemCollection(); lstColl.Add(new ListItem("Tab", "1")); lstColl.Add(new ListItem("Module", "2")); ddlControlType.DataSource = lstColl; ddlControlType.DataTextField = "Text"; ddlControlType.DataValueField = "Value"; ddlControlType.DataBind(); ddlControlType.Items.Insert(0, new ListItem("- Chọn -", "0")); ddlControlType.SelectedIndex = 0; }
private void SelectListBoxItems(ListItemCollection listItems, string req) { if(req == null || req.Length == 0) return; string items_string = "," + req + ","; foreach(ListItem itm in listItems) { if(items_string.IndexOf("," + itm.Value + ",") != -1) itm.Selected = true; else itm.Selected = false; } }
protected void LoadStatus2DDL() { //Load list item to dropdownlist ListItemCollection lstColl = new ListItemCollection(); lstColl.Add(new ListItem("Active", "1")); lstColl.Add(new ListItem("InActive", "0")); ddlStatus.DataSource = lstColl; ddlStatus.DataTextField = "Text"; ddlStatus.DataValueField = "Value"; ddlStatus.DataBind(); ddlStatus.AutoPostBack = true; }
/// <summary> /// 得到按指定分割符的选项字符串 /// </summary> /// <param name="split">指定分割符</param> /// <param name="items">列表选项(含未选中的选项)</param> /// <returns></returns> public string GetSelectString(string split, System.Web.UI.WebControls.ListItemCollection items) { split = split.Trim(); string result = ""; foreach (ListItem li in items) { if (li.Selected) { result = result + li.Value + split; } } return(result.TrimEnd(split.ToCharArray())); }
protected void LoadDiscontinued2DDL() { //Load list item to dropdownlist ListItemCollection lstColl = new ListItemCollection(); lstColl.Add(new ListItem("Hiện", "1")); lstColl.Add(new ListItem("Ẩn", "0")); ddlDiscontinued.DataSource = lstColl; ddlDiscontinued.DataTextField = "Text"; ddlDiscontinued.DataValueField = "Value"; ddlDiscontinued.DataBind(); ddlDiscontinued.SelectedIndex = 0; // Select the first item ddlDiscontinued.AutoPostBack = true; }
public static void FillTreeData(ListItemCollection lst, DataTable dtCommands, string fieldKey, string fieldName, string fieldParentID, string sortBy) { lst.Clear(); DataRow[] drRoots = dtCommands.Select(fieldParentID + " = " + 0, sortBy); foreach (DataRow row in drRoots) { ListItem item = new ListItem(); item.Value = row[fieldKey].ToString(); item.Text = row[fieldName].ToString(); item.Attributes.Add("Level", "0"); lst.Add(item); LoadCmdItem(lst, item, dtCommands, fieldKey, fieldName, fieldParentID, sortBy); } }
public static void Build(System.Web.UI.WebControls.ListItemCollection items, string alerttype, AlertConst alertconst) { items.Clear(); if (alerttype == BenQGuru.eMES.AlertModel.AlertType_Old.First || alerttype == BenQGuru.eMES.AlertModel.AlertType_Old.ResourceNG) { items.Add(new ListItem(alertconst.GetName(BenQGuru.eMES.AlertModel.Operator_Old.GE), BenQGuru.eMES.AlertModel.Operator_Old.GE)); } else { items.Add(new ListItem("介于", BenQGuru.eMES.AlertModel.Operator_Old.BW)); items.Add(new ListItem(alertconst.GetName(BenQGuru.eMES.AlertModel.Operator_Old.LE), BenQGuru.eMES.AlertModel.Operator_Old.LE)); items.Add(new ListItem(alertconst.GetName(BenQGuru.eMES.AlertModel.Operator_Old.GE), BenQGuru.eMES.AlertModel.Operator_Old.GE)); } }
public static void BindMetaTypesItemCollections(ListItemCollection items, bool IsAllItems) { ResourceManager LocRM2 = new ResourceManager("Mediachase.Ibn.WebResources.App_GlobalResources.Admin.Resources.strDefault", Assembly.Load(new AssemblyName("Mediachase.Ibn.WebResources"))); ResourceManager LocRM = new ResourceManager("Mediachase.UI.Web.App_GlobalResources.Lists.Resources.strLists", typeof(CommonHelper).Assembly); items.Clear(); if (IsAllItems) items.Add(new ListItem(LocRM2.GetString("tAllTypes"), "-1")); MetaTypeCollection coll = MetaType.GetMetaDataMetaTypes(); Hashtable htTypes = new Hashtable(); htTypes.Clear(); foreach (MetaType type in coll) { if (!(type.MetaDataType == MetaDataType.DictionaryMultivalue || type.MetaDataType == MetaDataType.DictionarySingleValue || type.MetaDataType == MetaDataType.EnumMultivalue || type.MetaDataType == MetaDataType.EnumSingleValue || type.MetaDataType == MetaDataType.StringDictionary || type.MetaDataType == MetaDataType.MetaObject)) htTypes.Add(type.Id.ToString(), type.FriendlyName); } items.Add(new ListItem(htTypes["31"].ToString(), "31")); htTypes.Remove("31"); items.Add(new ListItem(htTypes["32"].ToString(), "32")); htTypes.Remove("32"); items.Add(new ListItem(htTypes["26"].ToString(), "26")); htTypes.Remove("26"); items.Add(new ListItem(MetaType.Load(MetaDataType.Money).FriendlyName, "9")); items.Add(new ListItem(MetaType.Load(MetaDataType.Float).FriendlyName, "6")); items.Add(new ListItem(htTypes["28"].ToString(), "28")); htTypes.Remove("28"); items.Add(new ListItem(MetaType.Load(MetaDataType.DateTime).FriendlyName, "4")); items.Add(new ListItem(LocRM.GetString("Dictionary"), "0")); items.Add(new ListItem(htTypes["27"].ToString(), "27")); htTypes.Remove("27"); items.Add(new ListItem(htTypes["30"].ToString(), "30")); htTypes.Remove("30"); items.Add(new ListItem(htTypes["33"].ToString(), "33")); htTypes.Remove("33"); items.Add(new ListItem(htTypes["29"].ToString(), "29")); htTypes.Remove("29"); items.Add(new ListItem(htTypes["39"].ToString(), "39")); htTypes.Remove("39"); items.Add(new ListItem(htTypes["40"].ToString(), "40")); htTypes.Remove("40"); foreach (string s in htTypes.Keys) items.Add(new ListItem(htTypes[s].ToString(), s)); }
protected ListItem[] GetItems(System.Collections.Generic.List <Common.SolutionEntityFramework.BaseSolutionEntity> Source, string DataTextField, string DataValueField) { System.Web.UI.WebControls.DropDownList ddl = new DropDownList(); ddl.DataSource = Source; ddl.DataTextField = DataTextField; ddl.DataValueField = DataValueField; ddl.DataBind(); System.Web.UI.WebControls.ListItemCollection lista1 = new System.Web.UI.WebControls.ListItemCollection(); System.Web.UI.WebControls.ListItem[] lista2 = new System.Web.UI.WebControls.ListItem[ddl.Items.Count]; lista1.CopyTo(lista2, 0); ddl.Items.CopyTo(lista2, 0); return(lista2); }
public void LoadDomainGroup2RadioBtnList() { ListItemCollection lst = new ListItemCollection(); lst.Add(new ListItem("Tên miềm phổ biến", "1")); lst.Add(new ListItem("Tên miềm Việt Nam", "2")); lst.Add(new ListItem("Tên miềm Việt Nam theo địa giới hành chính", "3")); lst.Add(new ListItem("Tên miềm Quốc Tế", "4")); rdlDomainGroup.Items.Clear(); rdlDomainGroup.DataSource = lst; rdlDomainGroup.DataBind(); rdlDomainGroup.SelectedIndex = 0; rdlDomainGroup.AutoPostBack = true; }
protected void btnCheckStorage_Click(object sender, EventArgs e) { ListItemCollection chosenRecipe = new ListItemCollection(); if (ddlChosenRecipe.Items.Count > 0) { foreach (ListItem cR in ddlChosenRecipe.Items) { chosenRecipe.Add(cR); } } myConnection.Close(); //closing connection Session["chosenRecipe"] = chosenRecipe; Session["portion"] = portion; Response.Redirect("ShoppingList.aspx"); }
private void @__BuildControl__control10(System.Web.UI.WebControls.ListItemCollection @__ctrl) { global::System.Web.UI.WebControls.ListItem @__ctrl1; @__ctrl1 = this.@__BuildControl__control11(); @__ctrl.Add(@__ctrl1); global::System.Web.UI.WebControls.ListItem @__ctrl2; @__ctrl2 = this.@__BuildControl__control12(); @__ctrl.Add(@__ctrl2); global::System.Web.UI.WebControls.ListItem @__ctrl3; @__ctrl3 = this.@__BuildControl__control13(); @__ctrl.Add(@__ctrl3); global::System.Web.UI.WebControls.ListItem @__ctrl4; @__ctrl4 = this.@__BuildControl__control14(); @__ctrl.Add(@__ctrl4); }
protected void LoadStatus2RadioBtnList(string selected_value) { //Load list item to dropdownlist ListItemCollection lstColl = new ListItemCollection(); lstColl.Add(new ListItem("Published", "2")); lstColl.Add(new ListItem("Active", "1")); lstColl.Add(new ListItem("InActive", "0")); rdlStatus.DataSource = lstColl; rdlStatus.DataTextField = "Text"; rdlStatus.DataValueField = "Value"; rdlStatus.DataBind(); rdlStatus.SelectedValue = selected_value; rdlStatus.AutoPostBack = false; }
/// <summary> /// Returns a list with the selected items and the given extra value if specified. /// </summary> /// <param name="listItems">Collection of the items are given in the field.</param> /// <param name="returnWithValues">If true, the result collection is constructed with value of the ListItem. If false, the value of the text property of the ListItem is used.</param> /// <returns>Collection of the selected items</returns> protected List<string> GetSelectedItems(ListItemCollection listItems, bool returnWithValues) { var selectedOptions = new List<string>(); foreach (ListItem item in listItems) { if (item.Selected) selectedOptions.Add(returnWithValues ? item.Value : item.Text); } if (selectedOptions.Contains(ExtraOptionValue)) { selectedOptions.Remove(ExtraOptionValue); selectedOptions.Add(GetExtraValue()); } return selectedOptions; }
protected void LoadStatus2DDL() { //Load list item to dropdownlist ListItemCollection lstColl = new ListItemCollection(); lstColl.Add(new ListItem("Active", "1")); lstColl.Add(new ListItem("InActive", "0")); ddlStatus.DataSource = lstColl; ddlStatus.DataTextField = "Text"; ddlStatus.DataValueField = "Value"; ddlStatus.DataBind(); ddlStatus.Items.Insert(0, new ListItem("Chọn trạng thái", "")); // add the new item at the top of the list ddlStatus.SelectedIndex = 1; // Select the first item ddlStatus.AutoPostBack = true; }
public static void LoadForCurItem(ListItemCollection lstItems, ListItem curItem,int idTrungTam) { int curId = ConvertUtility.ToInt32(curItem.Value); int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]); level++; DataTable dtChildZones = GetAllByParentID(curId, idTrungTam); if (dtChildZones == null) return; foreach (DataRow row in dtChildZones.Rows) { ListItem item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString()); item.Attributes.Add("Level", level.ToString()); lstItems.Add(item); LoadForCurItem(lstItems, item, idTrungTam); } }
protected ListItem[] GetItemsConSeleccioneObj(System.Collections.Generic.List <object> Source, string DataTextField, string DataValueField) { System.Web.UI.WebControls.DropDownList ddl = new DropDownList(); ddl.DataSource = Source; ddl.DataTextField = DataTextField; ddl.DataValueField = DataValueField; ddl.DataBind(); System.Web.UI.WebControls.ListItemCollection lista1 = new System.Web.UI.WebControls.ListItemCollection(); lista1.Add(new System.Web.UI.WebControls.ListItem("Seleccione...", "0")); System.Web.UI.WebControls.ListItem[] lista2 = new System.Web.UI.WebControls.ListItem[ddl.Items.Count + 1]; lista1.CopyTo(lista2, 0); ddl.Items.CopyTo(lista2, 1); return(lista2); }
protected void btnConfirmPlannedMeal_Click(object sender, EventArgs e) { if (lbChosenRecipe.Items.Count != 0) { if (txtDate.Text != "") { int portion = Convert.ToInt32(ddlPortion.SelectedValue); ListItemCollection chosenRecipe = new ListItemCollection(); OleDbCommand command = new OleDbCommand("INSERT INTO PlannedMeal(UserDataID, Portion, CreatedDate) VALUES(@UserDataID, @Portion, @CreatedDate)", myConnection); OleDbCommand command2 = new OleDbCommand("Select @@Identity", myConnection); command.CommandType = CommandType.Text; command2.CommandType = CommandType.Text; //adding parameters with value command.Parameters.AddWithValue("@UserDataID", userid.ToString()); command.Parameters.AddWithValue("@Portion", portion.ToString()); command.Parameters.AddWithValue("@CreatedDate", txtDate.Text.ToString()); command.ExecuteNonQuery(); //executing query command2.ExecuteNonQuery(); //executing query int plannedMealID = Convert.ToInt32(command2.ExecuteScalar()); if (lbChosenRecipe.Items.Count > 0) { foreach (ListItem cr in lbChosenRecipe.Items) { chosenRecipe.Add(cr); int recipeID = Convert.ToInt32(cr.Value); OleDbCommand insertCommand = new OleDbCommand("INSERT INTO PlannedMealRecipe(PlannedMealID, RecipeID) VALUES(@PlannedMealID, @RecipeID)", myConnection); insertCommand.CommandType = CommandType.Text; //adding parameters with value insertCommand.Parameters.AddWithValue("@PlannedMealID", plannedMealID.ToString()); insertCommand.Parameters.AddWithValue("@RecipeID", recipeID.ToString()); insertCommand.ExecuteNonQuery(); //executing query } } myConnection.Close(); //closing connection Session["chosenRecipe"] = chosenRecipe; Session["portion"] = portion; Response.Redirect("ShoppingList.aspx"); } else { lblCheckChosenRecipe.Text = "Please choose a date"; } } else { lblCheckChosenRecipe.Text = "Please choose an recipe"; } }
public static void LoadListItems(System.Web.UI.WebControls.ListItemCollection list, DataTable tblBind, DataTable tblVals, string textField, string valField) { ListItem l; for (int i = 0; i < tblBind.Rows.Count; i++) { l = new ListItem(tblBind.Rows[i][textField].ToString(), tblBind.Rows[i][valField].ToString()); DataRow dr; for (int x = 0; x < tblVals.Rows.Count; x++) { dr = tblVals.Rows[x]; if (dr[valField].ToString().ToLower().Equals(l.Value.ToLower())) { l.Selected = true; } } list.Add(l); } }
public static void Build(string alerttype, System.Web.UI.WebControls.ListItemCollection items, AlertConst alertConst) { items.Clear(); if (alerttype == AlertType_Old.NG) { items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item)); items.Add(new ListItem(alertConst.GetName(AlertItem_Old.SS), AlertItem_Old.SS)); items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Model), AlertItem_Old.Model)); items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Resource), AlertItem_Old.Resource)); } else if (alerttype == AlertType_Old.PPM || alerttype == AlertType_Old.CPK) { items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item)); } else if (alerttype == AlertType_Old.DirectPass) { items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item)); items.Add(new ListItem(alertConst.GetName(AlertItem_Old.SS), AlertItem_Old.SS)); items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Segment), AlertItem_Old.Segment)); } else if (alerttype == AlertType_Old.First) { items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item)); } else if (alerttype == AlertType_Old.ResourceNG) { items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item)); } else if (alerttype == AlertType_Old.Manual) { } else { items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item)); items.Add(new ListItem(alertConst.GetName(AlertItem_Old.SS), AlertItem_Old.SS)); items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Model), AlertItem_Old.Model)); items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Segment), AlertItem_Old.Segment)); items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Resource), AlertItem_Old.Resource)); } }
private void @__BuildControl__control22(System.Web.UI.WebControls.ListItemCollection @__ctrl) { global::System.Web.UI.WebControls.ListItem @__ctrl1; @__ctrl1 = this.@__BuildControl__control23(); @__ctrl.Add(@__ctrl1); global::System.Web.UI.WebControls.ListItem @__ctrl2; @__ctrl2 = this.@__BuildControl__control24(); @__ctrl.Add(@__ctrl2); global::System.Web.UI.WebControls.ListItem @__ctrl3; @__ctrl3 = this.@__BuildControl__control25(); @__ctrl.Add(@__ctrl3); global::System.Web.UI.WebControls.ListItem @__ctrl4; @__ctrl4 = this.@__BuildControl__control26(); @__ctrl.Add(@__ctrl4); global::System.Web.UI.WebControls.ListItem @__ctrl5; @__ctrl5 = this.@__BuildControl__control27(); @__ctrl.Add(@__ctrl5); global::System.Web.UI.WebControls.ListItem @__ctrl6; @__ctrl6 = this.@__BuildControl__control28(); @__ctrl.Add(@__ctrl6); global::System.Web.UI.WebControls.ListItem @__ctrl7; @__ctrl7 = this.@__BuildControl__control29(); @__ctrl.Add(@__ctrl7); global::System.Web.UI.WebControls.ListItem @__ctrl8; @__ctrl8 = this.@__BuildControl__control30(); @__ctrl.Add(@__ctrl8); global::System.Web.UI.WebControls.ListItem @__ctrl9; @__ctrl9 = this.@__BuildControl__control31(); @__ctrl.Add(@__ctrl9); global::System.Web.UI.WebControls.ListItem @__ctrl10; @__ctrl10 = this.@__BuildControl__control32(); @__ctrl.Add(@__ctrl10); global::System.Web.UI.WebControls.ListItem @__ctrl11; @__ctrl11 = this.@__BuildControl__control33(); @__ctrl.Add(@__ctrl11); global::System.Web.UI.WebControls.ListItem @__ctrl12; @__ctrl12 = this.@__BuildControl__control34(); @__ctrl.Add(@__ctrl12); }
private void btnSendGoods_Click(object sender, System.EventArgs e) { if (this.grdOrderGoods.Rows.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); return; } DropdownColumn dropdownColumn = (DropdownColumn)this.grdOrderGoods.Columns[4]; System.Web.UI.WebControls.ListItemCollection selectedItems = dropdownColumn.SelectedItems; DropdownColumn dropdownColumn2 = (DropdownColumn)this.grdOrderGoods.Columns[5]; System.Web.UI.WebControls.ListItemCollection selectedItems2 = dropdownColumn2.SelectedItems; int num = 0; for (int i = 0; i < selectedItems.Count; i++) { string orderId = (string)this.grdOrderGoods.DataKeys[this.grdOrderGoods.Rows[i].RowIndex].Value; System.Web.UI.WebControls.TextBox textBox = (System.Web.UI.WebControls.TextBox) this.grdOrderGoods.Rows[i].FindControl("txtShippOrderNumber"); System.Web.UI.WebControls.ListItem listItem = selectedItems[i]; System.Web.UI.WebControls.ListItem listItem2 = selectedItems2[i]; int num2 = 0; int.TryParse(listItem.Value, out num2); if (!string.IsNullOrEmpty(textBox.Text.Trim()) && !string.IsNullOrEmpty(listItem.Value) && int.Parse(listItem.Value) > 0 && !string.IsNullOrEmpty(listItem2.Value)) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId); if ((orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "Ecdev.plugins.payment.podrequest") || orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid) && num2 > 0 && !string.IsNullOrEmpty(textBox.Text.Trim()) && textBox.Text.Trim().Length <= 20) { ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(num2, true); orderInfo.RealShippingModeId = shippingMode.ModeId; orderInfo.RealModeName = shippingMode.Name; ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(listItem2.Value); orderInfo.ExpressCompanyName = expressCompanyInfo.Name; orderInfo.ExpressCompanyAbb = expressCompanyInfo.Kuaidi100Code; orderInfo.ShipOrderNumber = textBox.Text; if (OrderHelper.SendGoods(orderInfo)) { SendNoteInfo sendNoteInfo = new SendNoteInfo(); sendNoteInfo.NoteId = Globals.GetGenerateId() + num; sendNoteInfo.OrderId = orderId; sendNoteInfo.Operator = HiContext.Current.User.Username; sendNoteInfo.Remark = "后台" + sendNoteInfo.Operator + "发货成功"; OrderHelper.SaveSendNote(sendNoteInfo); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.Gateway); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (!string.IsNullOrEmpty(orderInfo.TaobaoOrderId)) { try { string requestUriString = string.Format("http://vip.ecdev.cn/UpdateShipping.ashx?tid={0}&companycode={1}&outsid={2}&Host={3}", new object[] { orderInfo.TaobaoOrderId, expressCompanyInfo.TaobaoCode, orderInfo.ShipOrderNumber, HiContext.Current.SiteUrl }); System.Net.WebRequest webRequest = System.Net.WebRequest.Create(requestUriString); webRequest.GetResponse(); } catch { } } int num3 = orderInfo.UserId; if (num3 == 1100) { num3 = 0; } IUser user = Users.GetUser(num3); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); num++; } } } } if (num == 0) { this.ShowMsg("批量发货失败!", false); return; } if (num > 0) { this.BindData(); this.ShowMsg(string.Format("批量发货成功!发货数量{0}个", num), true); } }
private void btnSendGoods_Click(object sender, System.EventArgs e) { if (this.grdOrderGoods.Rows.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); return; } DropdownColumn dropdownColumn = (DropdownColumn)this.grdOrderGoods.Columns[4]; System.Web.UI.WebControls.ListItemCollection selectedItems = dropdownColumn.SelectedItems; DropdownColumn dropdownColumn2 = (DropdownColumn)this.grdOrderGoods.Columns[5]; System.Web.UI.WebControls.ListItemCollection selectedItems2 = dropdownColumn2.SelectedItems; int num = 0; for (int i = 0; i < selectedItems.Count; i++) { string text = (string)this.grdOrderGoods.DataKeys[this.grdOrderGoods.Rows[i].RowIndex].Value; System.Web.UI.WebControls.TextBox textBox = (System.Web.UI.WebControls.TextBox) this.grdOrderGoods.Rows[i].FindControl("txtShippOrderNumber"); System.Web.UI.WebControls.ListItem listItem = selectedItems[i]; System.Web.UI.WebControls.ListItem listItem2 = selectedItems2[i]; int num2 = 0; int.TryParse(listItem.Value, out num2); if (!string.IsNullOrEmpty(textBox.Text.Trim()) && textBox.Text.Length <= 20 && num2 > 0) { PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(text); if (purchaseOrder != null && (purchaseOrder.PurchaseStatus == OrderStatus.BuyerAlreadyPaid || (purchaseOrder.PurchaseStatus == OrderStatus.WaitBuyerPay && purchaseOrder.Gateway == "hishop.plugins.payment.podrequest")) && !string.IsNullOrEmpty(listItem2.Value)) { ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(int.Parse(listItem.Value), true); purchaseOrder.RealShippingModeId = shippingMode.ModeId; purchaseOrder.RealModeName = shippingMode.Name; purchaseOrder.ExpressCompanyAbb = listItem2.Value; purchaseOrder.ExpressCompanyName = listItem2.Text; purchaseOrder.ShipOrderNumber = textBox.Text; if (SalesHelper.SendPurchaseOrderGoods(purchaseOrder)) { SendNote sendNote = new SendNote(); sendNote.NoteId = Globals.GetGenerateId() + num; sendNote.OrderId = text; sendNote.Operator = Hidistro.Membership.Context.HiContext.Current.User.Username; sendNote.Remark = "后台" + sendNote.Operator + "发货成功"; SalesHelper.SavePurchaseSendNote(sendNote); if (!string.IsNullOrEmpty(purchaseOrder.TaobaoOrderId)) { try { ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(purchaseOrder.ExpressCompanyName); string requestUriString = string.Format("http://order1.kuaidiangtong.com/UpdateShipping.ashx?tid={0}&companycode={1}&outsid={2}", purchaseOrder.TaobaoOrderId, expressCompanyInfo.TaobaoCode, purchaseOrder.ShipOrderNumber); System.Net.WebRequest webRequest = System.Net.WebRequest.Create(requestUriString); webRequest.GetResponse(); goto IL_27F; } catch { goto IL_27F; } goto IL_276; } IL_27F: num++; } } } IL_276 :; } if (num == 0) { this.ShowMsg("批量发货失败!", false); return; } if (num > 0) { this.BindData(); this.ShowMsg(string.Format("批量发货成功!发货数量{0}个", num), true); } }
private void btnSendGoods_Click(object sender, System.EventArgs e) { if (this.grdOrderGoods.Rows.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); return; } DropdownColumn dropdownColumn = (DropdownColumn)this.grdOrderGoods.Columns[4]; System.Web.UI.WebControls.ListItemCollection selectedItems = dropdownColumn.SelectedItems; int num = 0; for (int i = 0; i < selectedItems.Count; i++) { string orderId = (string)this.grdOrderGoods.DataKeys[this.grdOrderGoods.Rows[i].RowIndex].Value; System.Web.UI.WebControls.TextBox textBox = (System.Web.UI.WebControls.TextBox) this.grdOrderGoods.Rows[i].FindControl("txtShippOrderNumber"); System.Web.UI.WebControls.ListItem listItem = selectedItems[i]; int num2 = 0; int.TryParse(listItem.Value, out num2); OrderInfo orderInfo = SubsiteSalesHelper.GetOrderInfo(orderId); if (orderInfo != null && (orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid && num2 > 0 && !string.IsNullOrEmpty(textBox.Text) && textBox.Text.Length <= 20) { ShippingModeInfo shippingMode = SubsiteSalesHelper.GetShippingMode(num2, true); orderInfo.RealShippingModeId = shippingMode.ModeId; orderInfo.RealModeName = shippingMode.Name; orderInfo.ShipOrderNumber = textBox.Text; if (SubsiteSalesHelper.SendGoods(orderInfo)) { if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SubsiteSalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } int num3 = orderInfo.UserId; if (num3 == 1100) { num3 = 0; } Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num3); Messenger.OrderShipping(orderInfo, user); orderInfo.OnDeliver(); } num++; } } if (num == 0) { this.ShowMsg("批量发货失败!,发货数量0个", false); return; } if (num > 0) { this.BindData(); this.ShowMsg(string.Format("批量发货成功!,发货数量{0}个", num), true); } }
private void btnSendGoods_Click(object sender, System.EventArgs e) { if (this.grdOrderGoods.Rows.Count <= 0) { this.ShowMsg("没有要进行发货的订单。", false); } else { DropdownColumn column = (DropdownColumn)this.grdOrderGoods.Columns[4]; System.Web.UI.WebControls.ListItemCollection selectedItems = column.SelectedItems; DropdownColumn column2 = (DropdownColumn)this.grdOrderGoods.Columns[5]; System.Web.UI.WebControls.ListItemCollection items2 = column2.SelectedItems; int num = 0; for (int i = 0; i < selectedItems.Count; i++) { string orderId = (string)this.grdOrderGoods.DataKeys[this.grdOrderGoods.Rows[i].RowIndex].Value; System.Web.UI.WebControls.TextBox box = (System.Web.UI.WebControls.TextBox) this.grdOrderGoods.Rows[i].FindControl("txtShippOrderNumber"); System.Web.UI.WebControls.ListItem item = selectedItems[i]; System.Web.UI.WebControls.ListItem item2 = items2[i]; int result = 0; int.TryParse(item.Value, out result); if (!string.IsNullOrEmpty(box.Text.Trim()) && !string.IsNullOrEmpty(item.Value) && int.Parse(item.Value) > 0 && !string.IsNullOrEmpty(item2.Value)) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId); if ((orderInfo.GroupBuyId <= 0 || orderInfo.GroupBuyStatus == GroupBuyStatus.Success) && ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && orderInfo.Gateway == "hishop.plugins.payment.podrequest") || orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid) && result > 0 && !string.IsNullOrEmpty(box.Text.Trim()) && box.Text.Trim().Length <= 20) { ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(result, true); orderInfo.RealShippingModeId = shippingMode.ModeId; orderInfo.RealModeName = shippingMode.Name; orderInfo.ExpressCompanyAbb = item2.Value; orderInfo.ExpressCompanyName = item2.Text; orderInfo.ShipOrderNumber = box.Text; if (OrderHelper.SendGoods(orderInfo)) { SendNoteInfo info3 = new SendNoteInfo(); info3.NoteId = Globals.GetGenerateId() + num; info3.OrderId = orderId; info3.Operator = ManagerHelper.GetCurrentManager().UserName; info3.Remark = "后台" + info3.Operator + "发货成功"; OrderHelper.SaveSendNote(info3); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest") { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest") { SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); PayClient client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey); DeliverInfo deliver = new DeliverInfo { TransId = orderInfo.GatewayOrderId, OutTradeNo = orderInfo.OrderId, OpenId = MemberHelper.GetMember(orderInfo.UserId).OpenId }; client.DeliverNotify(deliver); } } orderInfo.OnDeliver(); num++; } } } } if (num == 0) { this.ShowMsg("批量发货失败!", false); } else { if (num > 0) { this.BindData(); this.ShowMsg(string.Format("批量发货成功!发货数量{0}个", num), true); } } } }
void PerformDataBinding(IEnumerable dataSource) { if (dataSource == null) #if NET_2_0 { goto setselected; } #else { return; } #endif #if NET_2_0 if (!AppendDataBoundItems) #endif Items.Clear(); string format = DataTextFormatString; if (format.Length == 0) { format = null; } string text_field = DataTextField; string value_field = DataValueField; if (text_field.Length == 0) { text_field = null; } if (value_field.Length == 0) { value_field = null; } ListItemCollection coll = Items; foreach (object container in dataSource) { string text; string val; text = val = null; if (text_field != null) { text = DataBinder.GetPropertyValue(container, text_field, format); } if (value_field != null) { val = DataBinder.GetPropertyValue(container, value_field).ToString(); } else if (text_field == null) { text = val = container.ToString(); if (format != null) { text = String.Format(format, container); } } else if (text != null) { val = text; } if (text == null) { text = val; } coll.Add(new ListItem(text, val)); } #if NET_2_0 setselected: if (!String.IsNullOrEmpty(_selectedValue)) { if (!SetSelectedValue(_selectedValue)) { throw new ArgumentOutOfRangeException("value", String.Format("'{0}' has a SelectedValue which is invalid because it does not exist in the list of items.", ID)); } if (_selectedIndex >= 0 && _selectedIndex != SelectedIndex) { throw new ArgumentException("SelectedIndex and SelectedValue are mutually exclusive."); } } else if (_selectedIndex >= 0) { SelectedIndex = _selectedIndex; } #else if (saved_selected_value != null) { SelectedValue = saved_selected_value; if (saved_selected_index != -2 && saved_selected_index != SelectedIndex) { throw new ArgumentException("SelectedIndex and SelectedValue are mutually exclusive."); } } else if (saved_selected_index != -2) { SelectedIndex = saved_selected_index; // No need to check saved_selected_value here, as it's done before. } #endif }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { if (Model.Groups.Count > 0) { groupList.DataSource = Model.Groups; groupList.DataBind(); groupList.Items.Insert(0, new ListItem(Localization.GetString("None_Specified"), Null.NullInteger.ToString())); } else { filterBySelector.Items.FindByValue("Group").Enabled = false; } foreach (var rel in Model.Relationships) { relationShipList.AddItem(Localization.GetString(rel.Name, Localization.SharedResourceFile), rel.RelationshipId.ToString()); } var profileResourceFile = "~/DesktopModules/Admin/Security/App_LocalResources/Profile.ascx"; System.Web.UI.WebControls.ListItemCollection propertiesCollection = GetPropertiesCollection(profileResourceFile); //Bind the ListItemCollection to the list propertyList.DataSource = propertiesCollection; propertyList.DataBind(); //Insert custom properties to the Search field lists propertiesCollection.Insert(0, new ListItem(Localization.GetString("Username", LocalResourceFile), "Username")); propertiesCollection.Insert(1, new ListItem(Localization.GetString("DisplayName", LocalResourceFile), "DisplayName")); propertiesCollection.Insert(2, new ListItem(Localization.GetString("Email", LocalResourceFile), "Email")); //Bind the properties collection in the Search Field Lists searchField1List.DataSource = propertiesCollection; searchField1List.DataBind(); searchField2List.DataSource = propertiesCollection; searchField2List.DataBind(); searchField3List.DataSource = propertiesCollection; searchField3List.DataBind(); searchField4List.DataSource = propertiesCollection; searchField4List.DataBind(); filterBySelector.Select(_filterBy, false, 0); switch (_filterBy) { case "Group": groupList.Select(_filterValue, false, 0); break; case "Relationship": relationShipList.Select(_filterValue, false, 0); break; case "ProfileProperty": propertyList.Select(_filterValue, false, 0); break; case "User": break; } searchField1List.Select(GetTabModuleSetting("SearchField1", _defaultSearchField1)); searchField2List.Select(GetTabModuleSetting("SearchField2", _defaultSearchField2)); searchField3List.Select(GetTabModuleSetting("SearchField3", _defaultSearchField3)); searchField4List.Select(GetTabModuleSetting("SearchField4", _defaultSearchField4)); } }