protected void LoadInvoicePreparationProgress() { Facade.IInvoice facProgress = new Facade.Invoice(); string userName = ((Entities.CustomPrincipal)Page.User).UserName; ClearFields(); m_InvoicePreparation = facProgress.LoadInvoicePreparationProgress(userName); // Load Params If Entity Is Populated if (m_InvoicePreparation != null) { lblSaveProgressNotification.Visible = true; lblSaveProgressNotification.ForeColor = Color.SeaGreen; lblSaveProgressNotification.Text = "The progress of your last search has been loaded. You can turn this off using the 'Clear Filter' button."; cboClient.SelectedValue = m_InvoicePreparation.ClientId.ToString(); m_IdentityId = Convert.ToInt32(m_InvoicePreparation.ClientId.ToString()); Facade.IOrganisation facOrganisation = new Facade.Organisation(); cboClient.Text = facOrganisation.GetForIdentityId(m_InvoicePreparation.ClientId).OrganisationName; dteStartDate.SelectedDate = m_InvoicePreparation.StartDate; dteEndDate.SelectedDate = m_InvoicePreparation.EndDate; // Load Array List To Grid After Loaded jobIdCSV = m_InvoicePreparation.JobIdCSV; // ie: '234,234,233' hidSelectedJobs.Value = "," + jobIdCSV; if (jobIdCSV != null && jobIdCSV.Length > 0) { m_selectedJobs.Clear(); string[] jobIds = jobIdCSV.Split(','); foreach (string jobId in jobIds) { m_selectedJobs.Add(jobId); } LoadGrid(); btnSaveFilter.Visible = true; } } else { lblSaveProgressNotification.Visible = true; lblSaveProgressNotification.ForeColor = Color.Red; lblSaveProgressNotification.Text = "No filter progress found."; btnLoadFilter.Visible = false; } }
protected void SaveInvoicePreparationProgress() { string userName = ((Entities.CustomPrincipal)Page.User).UserName; Facade.IInvoice facProgress = new Facade.Invoice(); if (ViewState["invoicePreparation"] == null) { m_InvoicePreparation = new Entities.InvoicePreparation(); } else { m_InvoicePreparation = (Entities.InvoicePreparation)ViewState["invoicePreparation"]; } // Params if (cboClient.SelectedValue != "") { m_InvoicePreparation.ClientId = Convert.ToInt32(cboClient.SelectedValue); } if (dteStartDate.SelectedDate == DateTime.MinValue) { m_InvoicePreparation.StartDate = DateTime.MinValue; } else { m_InvoicePreparation.StartDate = dteStartDate.SelectedDate.Value; } if (dteEndDate.SelectedDate == DateTime.MinValue) { m_InvoicePreparation.EndDate = DateTime.MinValue; } else { m_InvoicePreparation.EndDate = dteEndDate.SelectedDate.Value; } m_selectedJobs = GetJobsSelected(); m_InvoicePreparation.JobIdCSV = hidSelectedJobs.Value; m_InvoicePreparation.JobState = ((eJobState)cboJobState.SelectedIndex + 1); m_InvoicePreparation.UserName = userName; bool saved = false; if (dteStartDate.SelectedDate == DateTime.MinValue || dteEndDate.SelectedDate == DateTime.MinValue) { saved = facProgress.SaveInvoicePreparationProgress(m_InvoicePreparation); } else { saved = facProgress.SaveInvoicePreparationProgressWithDates(m_InvoicePreparation); } if (saved) { lblSaveProgressNotification.Visible = true; lblSaveProgressNotification.ForeColor = Color.Blue; lblSaveProgressNotification.Text = "You have successfully saved the progress filter."; LoadGrid(); } else { lblSaveProgressNotification.Visible = true; lblSaveProgressNotification.ForeColor = Color.Red; lblSaveProgressNotification.Text = "The unable to save the progress filter."; } }