private void Fill_cmbDateParameterType_DesignedReports() { string[] retMessage = new string[4]; try { this.InitializeCulture(); IList <ReportParameterDesigned> reportParamDesList = ReportParameterBusiness.GetAllReportParameterDesigned(); foreach (ReportParameterDesigned item in reportParamDesList) { ComboBoxItem comboItem = new ComboBoxItem(); comboItem.Text = item.Title; comboItem.Value = item.ID.ToString(); cmbDateParameterType_DesignedReports.Items.Add(comboItem); } } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_DateParameterType.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_DateParameterType.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_DateParameterType.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }
public string[] UpdateReport_DesignedReportsPage(string state, string SelectedReportID, string ReportName, string ReportDescription, string DesignedTypeID, string ParentReportID, string DateParameterTypeID, string ParentPath) { this.InitializeCulture(); string[] retMessage = new string[4]; try { decimal ReportID = 0; decimal selectedReportID = decimal.Parse(this.StringBuilder.CreateString(SelectedReportID), CultureInfo.InvariantCulture); string reportName = this.StringBuilder.CreateString(ReportName); string reportDescription = this.StringBuilder.CreateString(ReportDescription); decimal designedTypeID = decimal.Parse(this.StringBuilder.CreateString(DesignedTypeID), CultureInfo.InvariantCulture); decimal parentReportID = decimal.Parse(this.StringBuilder.CreateString(ParentReportID), CultureInfo.InvariantCulture); string parentPath = this.StringBuilder.CreateString(ParentPath); UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper()); GTS.Clock.Model.Report.Report report = new GTS.Clock.Model.Report.Report(); report.ID = selectedReportID; ReportParameterDesigned reportParameterDesignedObj = null; if (uam != UIActionType.DELETE) { GTS.Clock.Model.Report.DesignedReportType designedType = new BDesignedReportsColumn().GetAllDesignedReportsTypes().SingleOrDefault(d => d.ID == designedTypeID); report.Name = reportName; report.Description = reportDescription; report.DesignedType = designedType; report.ParentId = parentReportID; report.IsReport = true; report.IsDesignedReport = true; report.ParentPath = parentPath; decimal dateParamID = decimal.Parse(this.StringBuilder.CreateString(DateParameterTypeID), CultureInfo.InvariantCulture); if (designedType != null && designedType.CustomCode == DesignedReportTypeEnum.Person) { reportParameterDesignedObj = ReportParameterBusiness.GetAllReportParameterDesigned().SingleOrDefault(p => p.CustomCode == "None"); } else { reportParameterDesignedObj = ReportParameterBusiness.GetAllReportParameterDesigned().SingleOrDefault(p => p.ID == dateParamID); } report.ReportParameterDesigned = reportParameterDesignedObj; } BReportParameter reportParameterBusiness = new BReportParameter(); switch (uam) { case UIActionType.ADD: ReportID = this.ReportBusiness.InsertReport(report, uam); if (reportParameterDesignedObj != null) { foreach (ReportParameterDesignedParam item in reportParameterDesignedObj.ReportParameterDesignedParam) { GTS.Clock.Model.Report.ReportParameter reportParameterObj = new GTS.Clock.Model.Report.ReportParameter(); reportParameterObj.ID = 0; reportParameterObj.Report = new GTS.Clock.Model.Report.Report() { ID = ReportID }; reportParameterObj.Name = item.Parameter; reportParameterObj.ReportUIParameter = reportParameterDesignedObj.ReportUIParameter; decimal param1Id = reportParameterBusiness.InsertReportParameter(reportParameterObj); } } break; case UIActionType.EDIT: if (selectedReportID == 0) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, new Exception(GetLocalResourceObject("NoReportSelectedforEdit").ToString()), retMessage); return(retMessage); } ReportID = this.ReportBusiness.UpdateReport(report, uam); ReportParameterBusiness.DeleteReportParameterByReportID(ReportID); foreach (ReportParameterDesignedParam item in reportParameterDesignedObj.ReportParameterDesignedParam) { GTS.Clock.Model.Report.ReportParameter reportParameterObj = new GTS.Clock.Model.Report.ReportParameter(); reportParameterObj.ID = 0; reportParameterObj.Report = new GTS.Clock.Model.Report.Report() { ID = ReportID }; reportParameterObj.Name = item.Parameter; reportParameterObj.ReportUIParameter = reportParameterDesignedObj.ReportUIParameter; decimal param1Id = reportParameterBusiness.InsertReportParameter(reportParameterObj); } break; case UIActionType.DELETE: if (selectedReportID == 0) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, new Exception(GetLocalResourceObject("NoReportSelectedforEdit").ToString()), retMessage); return(retMessage); } this.ReportBusiness.CheckDeleteAccess(); ReportID = this.ReportBusiness.DeleteReport(selectedReportID); break; } retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString(); string SuccessMessageBody = string.Empty; switch (uam) { case UIActionType.ADD: SuccessMessageBody = GetLocalResourceObject("AddComplete").ToString(); break; case UIActionType.EDIT: SuccessMessageBody = GetLocalResourceObject("EditComplete").ToString(); break; case UIActionType.DELETE: SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString(); break; default: break; } retMessage[1] = SuccessMessageBody; retMessage[2] = "success"; retMessage[3] = ReportID.ToString(); return(retMessage); } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); return(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); return(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); return(retMessage); } }