public string[] UpdateColumn_DesignedReportsSelectColumnPage(string state, string SelectedColumnID, string Title, string Active, string ReportID, string ConceptID, string Order, string ColumnType, string TrafficColumnsCount, string KeyColumn)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            decimal      ColumnID            = 0;
            decimal      selectedColumnID    = decimal.Parse(this.StringBuilder.CreateString(SelectedColumnID), CultureInfo.InvariantCulture);
            string       title               = this.StringBuilder.CreateString(Title);
            bool         active              = Convert.ToBoolean(this.StringBuilder.CreateString(Active) == "" ? "false" : this.StringBuilder.CreateString(Active));
            decimal      reportID            = decimal.Parse(this.StringBuilder.CreateString(ReportID), CultureInfo.InvariantCulture);
            decimal      fieldId             = decimal.Parse(this.StringBuilder.CreateString(ConceptID), CultureInfo.InvariantCulture);
            Int16        order               = Int16.Parse(this.StringBuilder.CreateString(Order));
            int          trafficColumnsCount = int.Parse(this.StringBuilder.CreateString(TrafficColumnsCount), CultureInfo.InvariantCulture);
            bool         isConcept           = false;
            UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper());
            DesignedReportTrafficKeyColumn keyColumn = DesignedReportTrafficKeyColumn.AllTraffic;
            GTS.Clock.Model.Report.DesignedReportColumn columnObj = new GTS.Clock.Model.Report.DesignedReportColumn();
            columnObj.ID = selectedColumnID;
            GTS.Clock.Model.Report.Report reportObj = new GTS.Clock.Model.Report.Report();
            reportObj.ID     = reportID;
            columnObj.Report = reportObj;
            if (uam != UIActionType.DELETE)
            {
                DesignedReportColumnType columnType = DesignedReportColumnType.None;
                if (ColumnType != string.Empty)
                {
                    columnType = (DesignedReportColumnType)Enum.Parse(typeof(DesignedReportColumnType), this.StringBuilder.CreateString(ColumnType));
                }
                if (columnType == DesignedReportColumnType.Traffic)
                {
                    keyColumn = (DesignedReportTrafficKeyColumn)Enum.Parse(typeof(DesignedReportTrafficKeyColumn), this.StringBuilder.CreateString(KeyColumn));
                }

                GTS.Clock.Model.Concepts.SecondaryConcept conceptObj    = null;
                DesignedReportPersonInfoColumn            personInfoObj = null;
                DesignedReportTrafficColumn trafficObj          = null;
                PersonParamField            personParamFieldObj = null;
                switch (columnType)
                {
                case DesignedReportColumnType.Concept:
                    conceptObj           = new SecondaryConcept();
                    conceptObj.ID        = fieldId;
                    columnObj.ColumnType = DesignedReportColumnType.Concept;
                    isConcept            = true;

                    break;

                case DesignedReportColumnType.Traffic:
                    trafficObj           = new DesignedReportTrafficColumn();
                    trafficObj.ID        = fieldId;
                    trafficObj.Key       = keyColumn;
                    columnObj.ColumnType = DesignedReportColumnType.Traffic;

                    break;

                case DesignedReportColumnType.PersonInfo:
                    personInfoObj        = new DesignedReportPersonInfoColumn();
                    personInfoObj.ID     = fieldId;
                    columnObj.ColumnType = DesignedReportColumnType.PersonInfo;
                    break;

                case DesignedReportColumnType.PersonParam:
                    personParamFieldObj    = new PersonParamField();
                    personParamFieldObj.ID = fieldId;
                    columnObj.ColumnType   = DesignedReportColumnType.PersonParam;
                    break;

                default:
                    break;
                }



                columnObj.Title              = title;
                columnObj.Active             = active;
                columnObj.Concept            = conceptObj;
                columnObj.PersonInfo         = personInfoObj;
                columnObj.Traffic            = trafficObj;
                columnObj.PersonParam        = personParamFieldObj;
                columnObj.Order              = order;
                columnObj.IsConcept          = isConcept;
                columnObj.TrafficColumnCount = trafficColumnsCount;
                if (uam != UIActionType.EDIT)
                {
                    IList <GTS.Clock.Model.Report.DesignedReportColumn> designedReportColumnList = DesignedReportsColumnBusiness.GetDesignedReportsColumnsByReportID(reportID);
                    Int16 lastOrder = 0;
                    if (designedReportColumnList.Count > 0)
                    {
                        lastOrder = designedReportColumnList.OrderByDescending(o => o.Order).FirstOrDefault().Order;
                    }

                    columnObj.Order = (Int16)(lastOrder + 1);
                }
            }

            switch (uam)
            {
            case UIActionType.ADD:

                ColumnID = this.DesignedReportsColumnBusiness.InsertColumn(columnObj);

                break;

            case UIActionType.EDIT:
                if (selectedColumnID == 0)
                {
                    retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, new Exception(GetLocalResourceObject("NoColumnSelectedforEdit").ToString()), retMessage);
                    return(retMessage);
                }
                ColumnID = this.DesignedReportsColumnBusiness.UpdateColumn(columnObj);
                break;

            case UIActionType.DELETE:
                if (selectedColumnID == 0)
                {
                    retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, new Exception(GetLocalResourceObject("NoColumnSelectedforEdit").ToString()), retMessage);
                    return(retMessage);
                }
                ColumnID = this.DesignedReportsColumnBusiness.DeleteColumn(columnObj);
                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] = ColumnID.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);
        }
    }
예제 #2
0
    public string[] UpdateGroupColumn_ReportParametersConditionsPage(string state, string GroupColumnID, string ReportID, string DesignedColumnID, string GroupingNewPage)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            decimal      groupColumnID        = 0;
            decimal      seletedGroupColumnID = decimal.Parse(this.StringBuilder.CreateString(GroupColumnID), CultureInfo.InvariantCulture);
            decimal      designedColumnID     = decimal.Parse(this.StringBuilder.CreateString(DesignedColumnID), CultureInfo.InvariantCulture);
            decimal      reportID             = decimal.Parse(this.StringBuilder.CreateString(ReportID), CultureInfo.InvariantCulture);
            bool         groupingNewPage      = bool.Parse(StringBuilder.CreateString(GroupingNewPage));
            UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper());

            GTS.Clock.Model.Report.DesignedReportGroupColumn groupColumnObj = new GTS.Clock.Model.Report.DesignedReportGroupColumn();
            groupColumnObj.ID = seletedGroupColumnID;
            if (uam != UIActionType.DELETE)
            {
                GTS.Clock.Model.Report.Report reportObj = new GTS.Clock.Model.Report.Report();
                reportObj.ID = reportID;
                decimal personId = BUser.CurrentUser.Person.ID;
                GTS.Clock.Model.Person personObj = new GTS.Clock.Model.Person();
                personObj.ID = personId;
                GTS.Clock.Model.Report.DesignedReportColumn designedColumnObj = new DesignedReportColumn();
                designedColumnObj.ID             = designedColumnID;
                groupColumnObj.Person            = personObj;
                groupColumnObj.Report            = reportObj;
                groupColumnObj.Column            = designedColumnObj;
                groupColumnObj.IsGroupingNewPage = groupingNewPage;
                if (uam != UIActionType.EDIT)
                {
                    IList <GTS.Clock.Model.Report.DesignedReportGroupColumn> designedReportGroupColumnList = GroupColumnBusiness.GetDesignedReportGroupColumns(reportID, personId);
                    Int16 lastOrder = 0;
                    if (designedReportGroupColumnList.Count > 0)
                    {
                        lastOrder = designedReportGroupColumnList.OrderByDescending(o => o.Order).FirstOrDefault().Order;
                    }

                    groupColumnObj.Order = (Int16)(lastOrder + 1);
                }
            }

            switch (uam)
            {
            case UIActionType.ADD:

                groupColumnID = this.GroupColumnBusiness.InsertGroupColumn(groupColumnObj);

                break;

            case UIActionType.DELETE:
                if (seletedGroupColumnID == 0)
                {
                    retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, new Exception(GetLocalResourceObject("NoColumnSelectedforEdit").ToString()), retMessage);
                    return(retMessage);
                }
                groupColumnID = this.GroupColumnBusiness.DeleteGroupColumn(groupColumnObj);
                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] = groupColumnID.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);
        }
    }
예제 #3
0
    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);
        }
    }
예제 #4
0
    public string[] UpdateConditions_ReportParametersConditionsPage(string ConditionID, string ReportID, string ConditionText, string ConditionValue, string OrderText, string OrderValue, string TrafficConditionValue)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            decimal conditionID   = decimal.Parse(this.StringBuilder.CreateString(ConditionID), CultureInfo.InvariantCulture);
            decimal reportID      = decimal.Parse(this.StringBuilder.CreateString(ReportID), CultureInfo.InvariantCulture);
            string  conditionText = "";
            if (ConditionText != null)
            {
                conditionText = this.StringBuilder.CreateString(ConditionText, StringGeneratorExceptionType.ReportCondition);
            }
            string conditionValue = "";
            if (ConditionValue != null)
            {
                conditionValue = this.StringBuilder.CreateString(ConditionValue, StringGeneratorExceptionType.ReportCondition);
            }

            string trafficConditionValue = "";
            if (trafficConditionValue != null)
            {
                trafficConditionValue = this.StringBuilder.CreateString(TrafficConditionValue, StringGeneratorExceptionType.ReportCondition);
            }
            string orderText = "";
            if (OrderText != null)
            {
                orderText = this.StringBuilder.CreateString(OrderText, StringGeneratorExceptionType.ReportCondition);
            }

            string orderValue = "";
            if (OrderValue != null)
            {
                orderValue = this.StringBuilder.CreateString(OrderValue, StringGeneratorExceptionType.ReportCondition);
            }

            GTS.Clock.Model.Security.User currentUser = BUser.CurrentUser;

            GTS.Clock.Model.Report.DesignedReportCondition conditionObj = new GTS.Clock.Model.Report.DesignedReportCondition();
            conditionObj.ID = conditionID;
            GTS.Clock.Model.Report.Report reportObj = new GTS.Clock.Model.Report.Report();
            GTS.Clock.Model.Person        personObj = new GTS.Clock.Model.Person()
            {
                ID = currentUser.Person.ID
            };
            reportObj.ID = reportID;

            conditionObj.ConditionText         = conditionText;
            conditionObj.ConditionValue        = conditionValue;
            conditionObj.TrafficConditionValue = trafficConditionValue;
            conditionObj.Report     = reportObj;
            conditionObj.Person     = personObj;;
            conditionObj.OrderText  = orderText;
            conditionObj.OrderValue = orderValue;


            UIActionType uam;
            if (conditionID == 0)
            {
                conditionID = ConditionBusiness.InsertCondition(conditionObj);
                uam         = UIActionType.ADD;
            }
            else
            {
                conditionID = ConditionBusiness.UpdateCondition(conditionObj);
                uam         = UIActionType.EDIT;
            }

            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] = conditionID.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);
        }
    }