/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DDL_PurchaseFiliale_OnSelectedIndexChanged(object sender, EventArgs e) { var innerPurchase = DDL_Purchase.SelectedItem.Value == "1"; DDL_SaleFiliale.Items.Clear(); Dictionary <string, string> dics = new Dictionary <string, string>(); if (innerPurchase) { var purcaseFilialeId = string.IsNullOrEmpty(DDL_PurchaseFiliale.SelectedValue)?Guid.Empty:new Guid(DDL_PurchaseFiliale.SelectedValue); IList <FilialeInfo> filialeLsit = CacheCollection.Filiale.GetList(); var shopList = filialeLsit.Where(ent => ent.FilialeTypes.Contains((int)MIS.Enum.FilialeType.EntityShop)) .ToList(); if (purcaseFilialeId != Guid.Empty) { var filialeInfo = filialeLsit.FirstOrDefault(ent => ent.ID == purcaseFilialeId); if (filialeInfo != null && filialeInfo.FilialeTypes.Contains((int)MIS.Enum.FilialeType.SaleCompany)) { shopList = shopList.Where(ent => ent.ParentId == purcaseFilialeId).ToList(); } } dics = shopList.ToDictionary(k => string.Format("{0}", k.ID), v => v.Name); } DDL_SaleFiliale.DataSource = dics; DDL_SaleFiliale.DataTextField = "Value"; DDL_SaleFiliale.DataValueField = "Key"; DDL_SaleFiliale.DataBind(); DDL_SaleFiliale.Items.Insert(0, new ListItem("全部", Guid.Empty.ToString())); DDL_SaleFiliale.SelectedIndex = 0; }
private void DdlHostingFilialeAuthChanged(IEnumerable <FilialeInfo> dataFiliale) { var dics = dataFiliale != null && dataFiliale.Any() ? dataFiliale.ToDictionary(dic => dic.ID, dic => dic.Name) : new Dictionary <Guid, string>(); DDL_SaleFiliale.DataSource = dics; DDL_SaleFiliale.DataTextField = "Value"; DDL_SaleFiliale.DataValueField = "Key"; DDL_SaleFiliale.DataBind(); DDL_SaleFiliale.Items.Insert(0, new ListItem("全部", Guid.Empty.ToString())); DDL_SaleFiliale.SelectedIndex = 0; }