Пример #1
0
    public string[] UpdateGridOrder_ReportParametersConditionsPage(string Type, string OrderRow, string ReportID)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            decimal            reportId            = int.Parse(this.StringBuilder.CreateString(ReportID), CultureInfo.InvariantCulture);
            int                selectedColumnOrder = int.Parse(this.StringBuilder.CreateString(OrderRow), CultureInfo.InvariantCulture);
            ActionGridRowOrder type     = (ActionGridRowOrder)Enum.Parse(typeof(ActionGridRowOrder), this.StringBuilder.CreateString(Type));
            decimal            personId = BUser.CurrentUser.Person.ID;
            IList <DesignedReportGroupColumn> columnList = DesignedReportGroupColumnBusiness.GetDesignedReportGroupColumns(reportId, personId);
            GTS.Clock.Model.Report.DesignedReportGroupColumn selectedColumn = columnList.Where(s => s.Order == selectedColumnOrder).FirstOrDefault();
            GTS.Clock.Model.Report.DesignedReportGroupColumn targetColumn   = new GTS.Clock.Model.Report.DesignedReportGroupColumn();
            switch (type)
            {
            case ActionGridRowOrder.Up:
                targetColumn         = columnList.Where(t => t.Order == (Int16)(selectedColumnOrder - 1)).FirstOrDefault();
                selectedColumn.Order = (Int16)(selectedColumn.Order - 1);
                targetColumn.Order   = (Int16)(targetColumn.Order + 1);

                break;

            case ActionGridRowOrder.Down:
                targetColumn = columnList.Where(t => t.Order == (Int16)(selectedColumnOrder + 1)).FirstOrDefault();

                selectedColumn.Order = (Int16)(selectedColumn.Order + 1);
                targetColumn.Order   = (Int16)(targetColumn.Order - 1);
                break;

            default:

                break;
            }
            if (targetColumn != null)
            {
                decimal targetId = DesignedReportGroupColumnBusiness.UpdateGroupColumn(targetColumn);
            }
            decimal columnId = DesignedReportGroupColumnBusiness.UpdateGroupColumn(selectedColumn);

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