Beispiel #1
0
        public string SelectSearchDropDown()
        {
            SetSite();
            var controlId  = Forms.Data("DropDownSearchTarget");
            var searchText = Forms.Data("DropDownSearchText");
            var column     = SearchDropDownColumn(controlId, searchText);
            var selected   = Forms.List("DropDownSearchResults");
            var editor     = Forms.Bool("DropDownSearchOnEditor");
            var multiple   = Forms.Bool("DropDownSearchMultiple");

            if (multiple)
            {
                return(SelectSearchDropDownResponse(controlId, column, selected, editor, multiple));
            }
            else if (selected.Count() != 1)
            {
                return(new ResponseCollection()
                       .Message(Messages.SelectOne())
                       .ToJson());
            }
            else
            {
                return(SelectSearchDropDownResponse(controlId, column, selected, editor, multiple));
            }
        }
        private static HtmlBuilder GridRows(
            this HtmlBuilder hb,
            SiteSettings ss,
            GridData gridData,
            View view,
            bool addHeader  = true,
            bool clearCheck = false)
        {
            var checkAll = clearCheck ? false : Forms.Bool("GridCheckAll");
            var columns  = ss.GetGridColumns(checkPermission: true);

            return(hb
                   .THead(
                       _using: addHeader,
                       action: () => hb
                       .GridHeader(
                           columns: columns,
                           view: view,
                           checkAll: checkAll))
                   .TBody(action: () => gridData.TBody(
                              hb: hb,
                              ss: ss,
                              columns: columns,
                              checkAll: checkAll)));
        }
Beispiel #3
0
        public string SelectSearchDropDown()
        {
            SetSite();
            var ss        = SiteSettingsUtilities.Get(Site, ReferenceId);
            var controlId = Forms.Data("DropDownSearchTarget");
            var column    = ss.Columns.FirstOrDefault(o =>
                                                      controlId.EndsWith(ss.ReferenceType + "_" + o.ColumnName));

            ss.SetChoiceHash(
                columnName: column?.ColumnName,
                searchIndexes: Forms.Data("DropDownSearchText").SearchIndexes());
            var selected = Forms.List("DropDownSearchResults");
            var multiple = Forms.Bool("DropDownSearchMultiple");

            if (multiple)
            {
                return(SelectSearchDropDownResponse(controlId, column, selected, multiple));
            }
            else if (selected.Count() != 1)
            {
                return(new ResponseCollection()
                       .Message(Messages.SelectOne())
                       .ToJson());
            }
            else
            {
                return(SelectSearchDropDownResponse(controlId, column, selected, multiple));
            }
        }
Beispiel #4
0
        public SiteModel GetSite(
            bool siteOnly           = false,
            bool initSiteSettings   = false,
            bool setSiteIntegration = false)
        {
            SiteModel siteModel;

            if (ReferenceType == "Sites" && Forms.Exists("Ver"))
            {
                siteModel = new SiteModel();
                siteModel.Get(
                    where : Rds.SitesWhere()
                    .SiteId(ReferenceId)
                    .Ver(Forms.Int("Ver")),
                    tableType: Sqls.TableTypes.NormalAndHistory);
                siteModel.VerType = Forms.Bool("Latest")
                    ? Versions.VerTypes.Latest
                    : Versions.VerTypes.History;
            }
            else
            {
                siteModel = siteOnly
                    ? new SiteModel(ReferenceId)
                    : new SiteModel(ReferenceType == "Sites" ? ReferenceId : SiteId);
            }
            if (initSiteSettings)
            {
                siteModel.SiteSettings = SiteSettingsUtilities.Get(
                    siteModel, ReferenceId, setSiteIntegration: setSiteIntegration);
            }
            return(siteModel);
        }
 /// <summary>
 /// Fixed:
 /// </summary>
 public void SetFormsAuthentication(string returnUrl)
 {
     System.Web.Security.FormsAuthentication.SetAuthCookie(
         UserId.ToString(), Forms.Bool("Users_RememberMe"));
     Sessions.SetTenantId(TenantId);
     SetSession();
     Libraries.Initializers.StatusesInitializer.Initialize(TenantId);
 }
        private bool?Bool(string controlId)
        {
            var data = Forms.Bool(controlId);

            if (data)
            {
                return(true);
            }
            else
            {
                return(null);
            }
        }
        public static string History(SiteSettings ss, int groupId)
        {
            var groupModel = new GroupModel(ss, groupId);

            ss.SetColumnAccessControls(groupModel.Mine());
            groupModel.Get(
                ss,
                where : Rds.GroupsWhere()
                .GroupId(groupModel.GroupId)
                .Ver(Forms.Int("Ver")),
                tableType: Sqls.TableTypes.NormalAndHistory);
            groupModel.VerType = Forms.Bool("Latest")
                ? Versions.VerTypes.Latest
                : Versions.VerTypes.History;
            return(EditorResponse(ss, groupModel).ToJson());
        }
Beispiel #8
0
        public static string History(SiteSettings ss, long wikiId)
        {
            var wikiModel = new WikiModel(ss, wikiId);

            ss.SetColumnAccessControls(wikiModel.Mine());
            wikiModel.Get(
                ss,
                where : Rds.WikisWhere()
                .WikiId(wikiModel.WikiId)
                .Ver(Forms.Int("Ver")),
                tableType: Sqls.TableTypes.NormalAndHistory);
            wikiModel.VerType = Forms.Bool("Latest")
                ? Versions.VerTypes.Latest
                : Versions.VerTypes.History;
            return(EditorResponse(ss, wikiModel).ToJson());
        }
Beispiel #9
0
        public static string History(Context context, SiteSettings ss, int deptId)
        {
            var deptModel = new DeptModel(context: context, ss: ss, deptId: deptId);

            ss.SetColumnAccessControls(
                context: context,
                mine: deptModel.Mine(context: context));
            deptModel.Get(
                context: context,
                ss: ss,
                where : Rds.DeptsWhere()
                .DeptId(deptModel.DeptId)
                .Ver(Forms.Int("Ver")),
                tableType: Sqls.TableTypes.NormalAndHistory);
            deptModel.VerType = Forms.Bool("Latest")
                ? Versions.VerTypes.Latest
                : Versions.VerTypes.History;
            return(EditorResponse(context, ss, deptModel).ToJson());
        }
Beispiel #10
0
        private static HtmlBuilder GridRows(
            this HtmlBuilder hb,
            SiteSettings ss,
            DeptCollection deptCollection,
            View view,
            bool addHeader  = true,
            bool clearCheck = false)
        {
            var checkAll = clearCheck ? false : Forms.Bool("GridCheckAll");
            var columns  = ss.GetGridColumns(checkPermission: true);

            return(hb
                   .THead(
                       _using: addHeader,
                       action: () => hb
                       .GridHeader(
                           columns: columns,
                           view: view,
                           checkAll: checkAll))
                   .TBody(action: () => deptCollection
                          .ForEach(deptModel => hb
                                   .Tr(
                                       attributes: new HtmlAttributes()
                                       .Class("grid-row")
                                       .DataId(deptModel.DeptId.ToString()),
                                       action: () =>
            {
                hb.Td(action: () => hb
                      .CheckBox(
                          controlCss: "grid-check",
                          _checked: checkAll,
                          dataId: deptModel.DeptId.ToString()));
                columns
                .ForEach(column => hb
                         .TdValue(
                             ss: ss,
                             column: column,
                             deptModel: deptModel));
            }))));
        }
        public void SetByForm(SiteSettings ss)
        {
            var columnFilterPrefix = "ViewFilters__";
            var columnSorterPrefix = "ViewSorters__";

            switch (Forms.Data("ControlId"))
            {
            case "ViewFilters_Reset":
                Incomplete         = null;
                Own                = null;
                NearCompletionTime = null;
                Delay              = null;
                Overdue            = null;
                ColumnFilterHash   = null;
                Search             = null;
                break;

            case "ViewSorters_Reset":
                ColumnSorterHash = null;
                break;
            }
            foreach (string controlId in HttpContext.Current.Request.Form)
            {
                switch (controlId)
                {
                case "ViewName":
                    Name = String(controlId);
                    break;

                case "ViewFilters_Incomplete":
                    Incomplete = Bool(controlId);
                    break;

                case "ViewFilters_Own":
                    Own = Bool(controlId);
                    break;

                case "ViewFilters_NearCompletionTime":
                    NearCompletionTime = Bool(controlId);
                    break;

                case "ViewFilters_Delay":
                    Delay = Bool(controlId);
                    break;

                case "ViewFilters_Overdue":
                    Overdue = Bool(controlId);
                    break;

                case "ViewFilters_Search":
                    Search = String(controlId);
                    break;

                case "ViewSorters":
                    SetSorters(ss);
                    break;

                case "CalendarFromTo":
                    CalendarFromTo = String(controlId);
                    break;

                case "CalendarMonth":
                    CalendarMonth = Time(controlId);
                    break;

                case "CrosstabGroupByX":
                    CrosstabGroupByX = String(controlId);
                    break;

                case "CrosstabGroupByY":
                    CrosstabGroupByY = String(controlId);
                    break;

                case "CrosstabColumns":
                    CrosstabColumns = String(controlId);
                    break;

                case "CrosstabAggregateType":
                    CrosstabAggregateType = String(controlId);
                    break;

                case "CrosstabValue":
                    CrosstabValue = String(controlId);
                    break;

                case "CrosstabTimePeriod":
                    CrosstabTimePeriod = String(controlId);
                    break;

                case "CrosstabMonth":
                    CrosstabMonth = Time(controlId);
                    break;

                case "GanttGroupBy":
                    GanttGroupBy = String(controlId);
                    break;

                case "GanttSortBy":
                    GanttSortBy = String(controlId);
                    break;

                case "GanttPeriod":
                    GanttPeriod = Forms.Int(controlId);
                    break;

                case "GanttStartDate":
                    GanttStartDate = Time(controlId).ToDateTime().ToUniversal();
                    break;

                case "TimeSeriesGroupBy":
                    TimeSeriesGroupBy = String(controlId);
                    break;

                case "TimeSeriesAggregateType":
                    TimeSeriesAggregateType = String(controlId);
                    break;

                case "TimeSeriesValue":
                    TimeSeriesValue = String(controlId);
                    break;

                case "KambanGroupByX":
                    KambanGroupByX = String(controlId);
                    break;

                case "KambanGroupByY":
                    KambanGroupByY = String(controlId);
                    break;

                case "KambanAggregateType":
                    KambanAggregateType = String(controlId);
                    break;

                case "KambanValue":
                    KambanValue = String(controlId);
                    break;

                case "KambanColumns":
                    KambanColumns = Forms.Int(controlId);
                    break;

                case "KambanAggregationView":
                    KambanAggregationView = Forms.Bool(controlId);
                    break;

                default:
                    if (controlId.StartsWith(columnFilterPrefix))
                    {
                        AddColumnFilterHash(
                            ss,
                            controlId.Substring(columnFilterPrefix.Length),
                            Forms.Data(controlId));
                    }
                    else if (controlId.StartsWith(columnSorterPrefix))
                    {
                        AddColumnSorterHash(
                            ss,
                            controlId.Substring(columnSorterPrefix.Length),
                            OrderByType(Forms.Data(controlId)));
                    }
                    break;
                }
            }
            KambanColumns = KambanColumns ?? Parameters.General.KambanColumns;
        }