private List<CustomerInventoryGroup> RemoveSelectedCustomers() { List<CustomerInventoryGroup> selectedCustomers = new List<CustomerInventoryGroup>(); foreach (GridViewRow row_customer in this.gvSelectedOutlets.Rows) { CheckBox ck = ((CheckBox)row_customer.FindControl("chkSelectedItems")); Image imgCustomer = (Image)row_customer.FindControl("imgCustomer"); if (!ck.Checked) { CustomerInventoryGroup customer = new CustomerInventoryGroup { CustomerNumber = int.Parse(imgCustomer.AlternateText), CustomerName = row_customer.Cells[2].Text, BrandName = row_customer.Cells[3].Text, AccountName = imgCustomer.ToolTip.Split('-')[0], BranchName = imgCustomer.ToolTip.Split('-')[1] }; selectedCustomers.Add(customer); } } return selectedCustomers; }
private List<CustomerInventoryGroup> GetSelectedCustomers() { List<CustomerInventoryGroup> selectedCustomers = new List<CustomerInventoryGroup>(); foreach (GridViewRow customer_ in this.gvCustomerList.Rows) { CheckBox ck = ((CheckBox)customer_.FindControl("chkItems")); Image imgCustomer = (Image)customer_.FindControl("imgCustomer"); if (ck.Checked) { CustomerInventoryGroup customer = new CustomerInventoryGroup { RecordNumber = long.Parse(imgCustomer.AlternateText), CustomerNumber = int.Parse(customer_.Cells[2].Text), CustomerName = customer_.Cells[3].Text, BrandName = customer_.Cells[4].Text, InventoryGroupId = long.Parse(hfGroupIdToUpdate.Value), AccountName = imgCustomer.ToolTip.Split('-')[0], BranchName =imgCustomer.ToolTip .Split('-')[1] }; selectedCustomers.Add(customer); } } return selectedCustomers; }
private List<CustomerInventoryGroup> AddSelectedCustomers() { List<CustomerInventoryGroup> selectedCustomers = CUSTOMERS; foreach (GridViewRow row_customer in gvCustomers.Rows) { CheckBox ck = ((CheckBox)row_customer.FindControl("chkItems")); Image imgCustomer = (Image)row_customer.FindControl("imgCustomer"); if (ck.Checked) { CustomerReferenceLink CRL = CustInvGroupManager.GetCustomerLinkByCustCode(imgCustomer.ToolTip); BranchClass branch = BranchManager.GetBranchByCode(CRL.BranchCode); AccountClass account = AccountManager.GetAccountByCode(branch.AccountCode); string BrandName; if (string.IsNullOrEmpty(HttpUtility.HtmlDecode(row_customer.Cells[3].Text)) || string.IsNullOrWhiteSpace(HttpUtility.HtmlDecode(row_customer.Cells[3].Text))) { BrandName = brandManager.GetBrandByCode(CRL.BrandCode).BrandDescription; } else { BrandName = row_customer.Cells[3].Text; } CustomerInventoryGroup customer = new CustomerInventoryGroup { CustomerNumber = int.Parse(imgCustomer.AlternateText), CustomerName = row_customer.Cells[2].Text, BrandName = BrandName, AccountName = account.AccountName, BranchName = branch.BranchName }; if (!IsAlreadySelected(CUSTOMERS, customer.CustomerNumber)) { if (string.IsNullOrEmpty(customer.AccountName) || string.IsNullOrWhiteSpace(customer.AccountName)) { hfWarningHandler_ModalPopupExtender.Show(); } else { selectedCustomers.Add(customer); } } } } return selectedCustomers; }