private void btnAssign_Click(object sender, EventArgs e) { ArrayList arrJobId = null; string jobIdCSV = string.Empty; string userName = ((Entities.CustomPrincipal)Page.User).UserName; btnAssign.DisableServerSideValidation(); arrJobId = GetJobsSelected(); if (arrJobId.Count == 0) { foreach (object item in arrJobId) { if (jobIdCSV != String.Empty) { jobIdCSV += ","; } jobIdCSV += (item); } lblAssignUpdate.Text = "No jobs have be selected to assign invoice number, please select jobs to assign."; lblAssignUpdate.ForeColor = Color.Red; return; } else { // Add the invoice number to the selected jobs ids. Facade.IJobSubContractor facSub = new Facade.Job(); Entities.FacadeResult result = facSub.AssignInvoiceNumber(txtInvoiceNumber.Text, hidSelectedJobs.Value, userName); //brInvoice.ValidateSubContractors(jobIdCSV); if (result.Success) { lblAssignUpdate.Text = "The jobs have been assigned the customers invoice number"; lblAssignUpdate.ForeColor = Color.Blue; txtInvoiceNumber.Text = string.Empty; LoadGrid(); } else { // Display errors infringementDisplay.Infringements = result.Infringements; infringementDisplay.DisplayInfringments(); lblAssignUpdate.Text = "The jobs have been failed to assign the customers invoice number"; lblAssignUpdate.ForeColor = Color.Red; } } }