private void SaveAssignedCompanies() { if (ChangedCompanies.Value == "true") { ArrayList _NewRelatedProductIDs = SelectedCompaniesList; BECompanyUsers.tbl_CompanyUserCompaniesRow relatedProduct; BPCompanyUserCompanies bp = new BPCompanyUserCompanies(); BECompanyUsers DSCompanies = new BECompanyUsers(); bp.DeleteAssignedCompaniesByCompanyUserID(CompanyUserID); foreach (object tmpProdID in _NewRelatedProductIDs) { relatedProduct = DSCompanies.tbl_CompanyUserCompanies.Newtbl_CompanyUserCompaniesRow(); relatedProduct.CompanyUserID = CompanyUserID; relatedProduct.CompanyID = Convert.ToInt32(tmpProdID); DSCompanies.tbl_CompanyUserCompanies.Addtbl_CompanyUserCompaniesRow(relatedProduct); } bp.Update(DSCompanies); } ViewAssignedCompanies(); }
protected void FillAvailableCompanies() { ddlAvailableCompanies.Items.Clear(); BPCompanyUserCompanies bp = new BPCompanyUserCompanies(); DSCompanies = bp.SelectNonAssignedCompaniesByCompanyUserID(CompanyUserID); DSCompanies.tbl_CompanyUserCompanies.DefaultView.Sort = "CompanyName"; ddlAvailableCompanies.DataTextField = "CompanyName"; ddlAvailableCompanies.DataValueField = "CompanyID"; ddlAvailableCompanies.DataBind(); }
protected void FillSelectedCompanies() { if (CompanyUserID > 0) { ChangedCompanies.Value = "false"; ddlSelectedCompanies.Items.Clear(); BPCompanyUserCompanies bp = new BPCompanyUserCompanies(); DSCompanies = bp.SelectCompanyUserCompaniesByCompanyUserID(CompanyUserID); if (DSCompanies.tbl_CompanyUserCompanies.Count > 0) { ddlSelectedCompanies.DataTextField = "CompanyName"; ddlSelectedCompanies.DataValueField = "CompanyID"; ddlSelectedCompanies.DataBind(); SelectedCompanies.Value = ""; foreach (BECompanyUsers.tbl_CompanyUserCompaniesRow content in DSCompanies.tbl_CompanyUserCompanies) { SelectedCompanies.Value += content.CompanyID + ","; } } } }
private void ViewAssignedCompanies() { BPCompanyUserCompanies bp = new BPCompanyUserCompanies(); DSCompanies = bp.SelectCompanyUserCompaniesByCompanyUserID(CompanyUserID); dgAssignedCompanies.DataBind(); }