public void BindHostingFiliale(WarehouseAuth warehouse) { var hostingFilialeAuths = new List <HostingFilialeAuth>(); if (warehouse != null) { foreach (var storage in warehouse.Storages) { foreach (var hostingFilialeAuth in storage.Filiales.Where(act => act.HostingFilialeId != Guid.Empty)) { if (hostingFilialeAuths.Any(act => act.HostingFilialeId == hostingFilialeAuth.HostingFilialeId)) { continue; } hostingFilialeAuths.Add(hostingFilialeAuth); } } } var datasource = new List <HostingFilialeAuth>(); if (hostingFilialeAuths.Count > 0) { datasource.Add(new HostingFilialeAuth { HostingFilialeId = Guid.Empty, HostingFilialeName = "--请选择--" }); } datasource.AddRange(hostingFilialeAuths); RCB_SaleFiliale.DataSource = datasource; RCB_SaleFiliale.DataTextField = "HostingFilialeName"; RCB_SaleFiliale.DataValueField = "HostingFilialeId"; RCB_SaleFiliale.DataBind(); }
public static Dictionary <Guid, HostingFilialeAuth> GetHostingFilialeAuth(WarehouseAuth warehouseAuth) { Dictionary <Guid, HostingFilialeAuth> hostiingFilialeAuthDics = new Dictionary <Guid, HostingFilialeAuth>(); if (warehouseAuth.Storages != null) { foreach (var item in warehouseAuth.Storages.Where(ent => ent.Filiales != null)) { foreach (var filialeAuth in item.Filiales) { if (!hostiingFilialeAuthDics.ContainsKey(filialeAuth.HostingFilialeId)) { hostiingFilialeAuthDics.Add(filialeAuth.HostingFilialeId, filialeAuth); } } } } return(hostiingFilialeAuthDics); }
protected void RCBWarehouse_OnSelectedIndexChanged(object sender, EventArgs e) { var cb = (RadComboBox)sender; if (cb != null) { var warehouse = WarehouseAuth.FirstOrDefault(act => act.WarehouseId == new Guid(cb.SelectedItem.Value)); var filiales = new List <HostingFilialeAuth> { new HostingFilialeAuth { HostingFilialeId = Guid.Empty, HostingFilialeName = "请选择物流公司" } }; if (warehouse != null) { foreach (var hostingFilialeAuth in warehouse.FilialeAuths) { if (filiales.Any(act => act.HostingFilialeId == hostingFilialeAuth.HostingFilialeId)) { continue; } filiales.Add(hostingFilialeAuth); foreach (var proxyFiliale in hostingFilialeAuth.ProxyFiliales.Where(proxyFiliale => filiales.All(ent => ent.HostingFilialeId != proxyFiliale.ProxyFilialeId))) { filiales.Add(new HostingFilialeAuth { HostingFilialeId = proxyFiliale.ProxyFilialeId, HostingFilialeName = proxyFiliale.ProxyFilialeName }); } } } if (filiales.Count == 1) { DdlSaleFiliale.Items.Clear(); return; } DdlSaleFiliale.DataSource = filiales.ToDictionary(k => k.HostingFilialeId, v => v.HostingFilialeName); DdlSaleFiliale.DataBind(); } }