Ejemplo n.º 1
0
        private static void MapViewToModel(ReportsSettings reportsSettings, ReportsSettingsView reportsSettingsView, int memberId)
        {
            reportsSettings.QueryName = reportsSettingsView.QueryName;
            reportsSettings.MemberId  = memberId;

            reportsSettings.GroupById           = reportsSettingsView.GroupById ?? (int)Constants.ReportsGroupBy.Date;
            reportsSettings.DateFrom            = reportsSettingsView.DateFrom;
            reportsSettings.DateTo              = reportsSettingsView.DateTo;
            reportsSettings.FilterProjectIds    = CommonHelpers.ConvertFromArrayOfIntsToString(reportsSettingsView.ProjectIds);
            reportsSettings.FilterMemberIds     = CommonHelpers.ConvertFromArrayOfIntsToString(reportsSettingsView.MemberIds);
            reportsSettings.FilterClientIds     = CommonHelpers.ConvertFromArrayOfNullableIntsToString(reportsSettingsView.ClientIds);
            reportsSettings.FilterShowColumnIds = CommonHelpers.ConvertFromArrayOfIntsToString(reportsSettingsView.ShowColumnIds);
        }
        public static ReportsSettings GetModel(this ReportsSettings reportsSettings, ReportsSettingsView reportsSettingsView, int memberId)
        {
            reportsSettings.QueryName = reportsSettingsView.QueryName;
            reportsSettings.MemberId  = memberId;

            reportsSettings.IsCurrentQuery = true;

            reportsSettings.GroupById    = reportsSettingsView.GroupById;
            reportsSettings.DateFrom     = reportsSettingsView.DateFrom;
            reportsSettings.DateTo       = reportsSettingsView.DateTo;
            reportsSettings.DateStaticId = reportsSettingsView.DateStaticId;

            reportsSettings.FilterProjectIds    = CommonHelpers.ConvertFromArrayOfIntsToString(reportsSettingsView.ProjectIds);
            reportsSettings.FilterMemberIds     = CommonHelpers.ConvertFromArrayOfIntsToString(reportsSettingsView.MemberIds);
            reportsSettings.FilterClientIds     = CommonHelpers.ConvertFromArrayOfNullableIntsToString(reportsSettingsView.ClientIds);
            reportsSettings.FilterShowColumnIds = CommonHelpers.ConvertFromArrayOfIntsToString(reportsSettingsView.ShowColumnIds);

            return(reportsSettings);
        }