private void SetBranchForEdit(string productId, string campaignId, string staffTypeId) { try { var list = AccessRightBiz.SearchAccessRight(productId, campaignId, staffTypeId, ""); List <ControlListData> selectedList = list.Select(p => new ControlListData { TextField = p.BranchName, ValueField = p.BranchCode }).OrderBy(p => p.TextField).ToList(); BindListBox(lboxBranchSelected, selectedList); List <ControlListData> allBranchList = BranchBiz.GetBranchListByRole(SLMConstant.Branch.All, staffTypeId); foreach (ControlListData data in selectedList) { ControlListData obj = allBranchList.Where(p => p.ValueField == data.ValueField).FirstOrDefault(); if (obj != null) { allBranchList.Remove(obj); } } BindListBox(lboxBranchAll, allBranchList); lblBranchAllTotal.Text = lboxBranchAll.Items.Count.ToString(); lblBranchSelectedTotal.Text = lboxBranchSelected.Items.Count.ToString(); } catch { throw; } }
protected void cmbStaffTypePopup_SelectedIndexChanged(object sender, EventArgs e) { try { BindListBox(lboxBranchAll, BranchBiz.GetBranchListByRole(SLMConstant.Branch.All, cmbStaffTypePopup.SelectedItem.Value)); lblBranchAllTotal.Text = lboxBranchAll.Items.Count.ToString(); lboxBranchSelected.Items.Clear(); lblBranchSelectedTotal.Text = lboxBranchSelected.Items.Count.ToString(); upPopupBranchSection.Update(); mpePopup.Show(); } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Error(message); AppUtil.ClientAlert(Page, message); } }