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; } }
private void SetBranchForEdit(string holidayDate) { try { var list = CalendarBranchBiz.SearchCalendarBranch(holidayDate, "", ""); 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.GetBranchList(SLMConstant.Branch.All); 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; } }
private void SetAvailableStatusForEdit(string productId, string leadStatus, string rightAdd) { try { var list = ActivityConfigBiz.SearchActivityConfig(productId, leadStatus, rightAdd, ""); List <ControlListData> selectedList = list.Where(p => !string.IsNullOrEmpty(p.LeadAvailableStatusCode) && !string.IsNullOrEmpty(p.LeadAvailableStatusDesc)).Select(p => new ControlListData { TextField = p.LeadAvailableStatusDesc, ValueField = p.LeadAvailableStatusCode }).OrderBy(p => p.TextField).ToList(); BindListBox(lboxLeadStatusSelected, selectedList); List <ControlListData> allAvailableStatusList = OptionBiz.GetOptionListForActivityConfig(AppConstant.OptionType.LeadStatus).OrderBy(p => p.TextField).ToList(); foreach (ControlListData data in selectedList) { ControlListData obj = allAvailableStatusList.Where(p => p.ValueField == data.ValueField).FirstOrDefault(); if (obj != null) { allAvailableStatusList.Remove(obj); } } BindListBox(lboxLeadStatusAll, allAvailableStatusList); lblLeadStatusAllTotal.Text = lboxLeadStatusAll.Items.Count.ToString(); lblLeadStatusSelectedTotal.Text = lboxLeadStatusSelected.Items.Count.ToString(); } catch { throw; } }
public static List <ControlListData> GetStatusList() { List <ControlListData> cds = new List <ControlListData>(); ControlListData cd1 = new ControlListData(); cd1.ValueField = "Complete"; cd1.TextField = "Complete"; ControlListData cd2 = new ControlListData(); cd2.ValueField = "Submit"; cd2.TextField = "Submit"; cds.Add(cd1); cds.Add(cd2); return(cds); }
private void InitialControl() { //ประเภทบุคคล cmbCardType.DataSource = CardTypeBiz.GetCardTypeList(); cmbCardType.DataTextField = "TextField"; cmbCardType.DataValueField = "ValueField"; cmbCardType.DataBind(); cmbCardType.Items.Insert(0, new ListItem("", "")); //cmbCampaign.DataSource = SlmScr003Biz.GetAllActiveCampaignData(); cmbCampaign.DataSource = SlmScr003Biz.GetSaleAndBothCampaignData(); cmbCampaign.DataTextField = "TextField"; cmbCampaign.DataValueField = "ValueField"; cmbCampaign.DataBind(); cmbCampaign.Items.Insert(0, new ListItem("", "")); //GetOwnerLead(cmbCampaign.SelectedItem.Value); cmbChannel.DataSource = SlmScr003Biz.GetChannelData(); cmbChannel.DataTextField = "TextField"; cmbChannel.DataValueField = "ValueField"; cmbChannel.DataBind(); cmbChannel.Items.Insert(0, new ListItem("", "")); //Owner Lead //cmbOwnerLeadSearch.DataSource = SlmScr003Biz.GetOwnerList(HttpContext.Current.User.Identity.Name); //cmbOwnerLeadSearch.DataTextField = "TextField"; //cmbOwnerLeadSearch.DataValueField = "ValueField"; //cmbOwnerLeadSearch.DataBind(); //cmbOwnerLeadSearch.Items.Insert(0, new ListItem("", "")); var branchList = BranchBiz.GetBranchList(SLMConstant.Branch.All); //Owner Branch cmbOwnerBranchSearch.DataSource = branchList; cmbOwnerBranchSearch.DataTextField = "TextField"; cmbOwnerBranchSearch.DataValueField = "ValueField"; cmbOwnerBranchSearch.DataBind(); cmbOwnerBranchSearch.Items.Insert(0, new ListItem("", "")); cmbOwnerLeadSearch.Items.Insert(0, new ListItem("", "")); //BindOwnerLead(); //Delegate Branch cmbDelegateBranchSearch.DataSource = branchList; cmbDelegateBranchSearch.DataTextField = "TextField"; cmbDelegateBranchSearch.DataValueField = "ValueField"; cmbDelegateBranchSearch.DataBind(); cmbDelegateBranchSearch.Items.Insert(0, new ListItem("", "")); cmbDelegateLeadSearch.Items.Insert(0, new ListItem("", "")); //BindDelegateLead(); //CreateBy Branch cmbCreatebyBranchSearch.DataSource = branchList; cmbCreatebyBranchSearch.DataTextField = "TextField"; cmbCreatebyBranchSearch.DataValueField = "ValueField"; cmbCreatebyBranchSearch.DataBind(); cmbCreatebyBranchSearch.Items.Insert(0, new ListItem("", "")); cmbCreatebySearch.Items.Insert(0, new ListItem("", "")); //BindCreateByLead(); var statusList = SlmScr003Biz.GetOptionList(AppConstant.OptionType.LeadStatus); ControlListData data = statusList.Where(p => p.ValueField == "16").FirstOrDefault(); if (data != null) { statusList.Remove(data); } cbOptionList.DataSource = statusList; cbOptionList.DataTextField = "TextField"; cbOptionList.DataValueField = "ValueField"; cbOptionList.DataBind(); //ListItem lst = cbOptionList.Items.FindByValue("00"); //if (lst != null) lst.Selected = true; //lst = cbOptionList.Items.FindByValue("01"); //if (lst != null) lst.Selected = true; pcTop.SetVisible = false; }
private void InitialControl() { //ประเภทบุคคล cmbCardType.DataSource = CardTypeBiz.GetCardTypeList(); cmbCardType.DataTextField = "TextField"; cmbCardType.DataValueField = "ValueField"; cmbCardType.DataBind(); cmbCardType.Items.Insert(0, new ListItem("", "")); cmbCampaign.DataSource = SlmScr003Biz.GetSaleAndBothCampaignData(); cmbCampaign.DataTextField = "TextField"; cmbCampaign.DataValueField = "ValueField"; cmbCampaign.DataBind(); cmbCampaign.Items.Insert(0, new ListItem("", "")); cmbChannel.DataSource = SlmScr003Biz.GetChannelData(); cmbChannel.DataTextField = "TextField"; cmbChannel.DataValueField = "ValueField"; cmbChannel.DataBind(); cmbChannel.Items.Insert(0, new ListItem("", "")); var branchList = BranchBiz.GetBranchList(SLMConstant.Branch.All); //Owner Branch cmbOwnerBranchSearch.DataSource = branchList; cmbOwnerBranchSearch.DataTextField = "TextField"; cmbOwnerBranchSearch.DataValueField = "ValueField"; cmbOwnerBranchSearch.DataBind(); cmbOwnerBranchSearch.Items.Insert(0, new ListItem("", "")); cmbOwnerLeadSearch.Items.Insert(0, new ListItem("", "")); //Delegate Branch cmbDelegateBranchSearch.DataSource = branchList; cmbDelegateBranchSearch.DataTextField = "TextField"; cmbDelegateBranchSearch.DataValueField = "ValueField"; cmbDelegateBranchSearch.DataBind(); cmbDelegateBranchSearch.Items.Insert(0, new ListItem("", "")); cmbDelegateLeadSearch.Items.Insert(0, new ListItem("", "")); //CreateBy Branch cmbCreatebyBranchSearch.DataSource = branchList; cmbCreatebyBranchSearch.DataTextField = "TextField"; cmbCreatebyBranchSearch.DataValueField = "ValueField"; cmbCreatebyBranchSearch.DataBind(); cmbCreatebyBranchSearch.Items.Insert(0, new ListItem("", "")); cmbCreatebySearch.Items.Insert(0, new ListItem("", "")); var statusList = SlmScr003Biz.GetOptionList(AppConstant.OptionType.LeadStatus); ControlListData data = statusList.Where(p => p.ValueField == "16").FirstOrDefault(); if (data != null) { statusList.Remove(data); } cbOptionList.DataSource = statusList; cbOptionList.DataTextField = "TextField"; cbOptionList.DataValueField = "ValueField"; cbOptionList.DataBind(); pcTop.SetVisible = false; }