Exemplo n.º 1
0
        private string String(Context context, string controlId)
        {
            var data = context.Forms.Data(controlId);

            return(data != string.Empty ? data : null);
        }
Exemplo n.º 2
0
        private EnumerableRowCollection <DataRow> Items(
            Context context,
            SiteSettings ss,
            string searchText,
            Column parentColumn,
            List <long> parentIds,
            int offset,
            bool setAllChoices)
        {
            var tableName = $"{ss.ReferenceType}_Items";
            var view      = GetView(
                context: context,
                ss: ss);

            view.Search = searchText;
            var column = SetSqlColum(
                context: context,
                ss: ss,
                keyColumnName: Rds.IdColumn(tableName: ss.ReferenceType),
                textColumnName: "Title");

            var where = view.Where(
                context: context,
                ss: ss,
                where : Rds.ItemsWhere().ReferenceId_In(
                    tableName: tableName,
                    sub: new SqlStatement(ss.LinkHashRelatingColumnsSubQuery(
                                              context: context,
                                              referenceType: ss.ReferenceType,
                                              parentColumn: parentColumn,
                                              parentIds: parentIds)),
                    _using: (ss.ReferenceType == "Results" ||
                             ss.ReferenceType == "Issues") &&
                    (parentIds?.Any() ?? false) &&
                    parentColumn != null));
            var orderBy = view.OrderBy(
                context: context,
                ss: ss,
                orderBy: view.ColumnSorterHash?.Any() != true
                    ? new Rds.ItemsOrderByCollection().Title(tableName: tableName)
                    : null);
            var join = ss.Join(
                context: context,
                join: new IJoin[]
            {
                column,
                where,
                orderBy
            });
            var dataRows = Rds.ExecuteTable(
                context: context,
                statements: Rds.Select(
                    tableName: ss.ReferenceType,
                    dataTableName: "Main",
                    column: column,
                    join: join,
                    where : where,
                    orderBy: orderBy,
                    offset: offset,
                    pageSize: !setAllChoices
                        ? Parameters.General.DropDownSearchPageSize
                        : 0))
                           .AsEnumerable();

            return(dataRows);
        }
Exemplo n.º 3
0
        private EnumerableRowCollection <DataRow> Users(
            Context context,
            SiteSettings ss,
            long inheritPermission,
            string searchText,
            bool setAllChoices,
            int offset)
        {
            var view = GetView(
                context: context,
                ss: ss);
            var sqlColumn = SetSqlColum(
                context: context,
                ss: ss,
                keyColumnName: "UserId",
                textColumnName: "Name");
            var dataRows = Rds.ExecuteTable(
                context: context,
                statements: Rds.SelectUsers(
                    column: sqlColumn,
                    join: Rds.UsersJoin()
                    .Add(new SqlJoin(
                             tableBracket: "\"Depts\"",
                             joinType: SqlJoin.JoinTypes.LeftOuter,
                             joinExpression: "\"Users\".\"DeptId\"=\"Depts\".\"DeptId\"")),
                    where : view.Where(
                        context: context,
                        ss: ss,
                        where : Rds.UsersWhere()
                        .TenantId(context.TenantId)
                        .SiteUserWhere(
                            context: context,
                            siteId: inheritPermission,
                            _using: MembersOnly == true)
                        .SqlWhereLike(
                            tableName: "Depts",
                            name: "SearchText",
                            searchText: searchText,
                            clauseCollection: new List <string>()
            {
                Rds.Users_LoginId_WhereLike(factory: context),
                Rds.Users_Name_WhereLike(factory: context),
                Rds.Users_UserCode_WhereLike(factory: context),
                Rds.Users_Body_WhereLike(factory: context),
                Rds.Depts_DeptCode_WhereLike(factory: context),
                Rds.Depts_DeptName_WhereLike(factory: context),
                Rds.Depts_Body_WhereLike(factory: context)
            })),
                    orderBy: view.OrderBy(
                        context: context,
                        ss: ss,
                        orderBy: view.ColumnSorterHash?.Any() != true
                            ? Rds.UsersOrderBy().Name()
                            : null),
                    offset: offset,
                    pageSize: !setAllChoices
                        ? Parameters.General.DropDownSearchPageSize
                        : 0))
                           .AsEnumerable();

            return(dataRows);
        }
Exemplo n.º 4
0
        public void SetChoiceHash(
            Context context,
            SiteSettings ss,
            Column column,
            string searchText,
            Column parentColumn,
            List <long> parentIds,
            int offset,
            bool search,
            bool searchFormat,
            bool setAllChoices,
            bool setChoices)
        {
            switch (TableName)
            {
            case "Depts":
                column.Type = Column.Types.Dept;
                if (setChoices)
                {
                    if (column.UseSearch != true || search || setAllChoices)
                    {
                        var currentSs = SiteSettingsUtilities.DeptsSiteSettings(context: context);
                        Set(
                            context: context,
                            ss: currentSs,
                            column: column,
                            dataRows: Depts(
                                context: context,
                                ss: currentSs,
                                inheritPermission: ss.InheritPermission,
                                searchText: searchText,
                                setAllChoices: setAllChoices,
                                offset: offset),
                            searchFormat: searchFormat);
                    }
                }
                break;

            case "Groups":
                column.Type = Column.Types.Group;
                if (setChoices)
                {
                    if (column.UseSearch != true || search || setAllChoices)
                    {
                        var currentSs = SiteSettingsUtilities.GroupsSiteSettings(context: context);
                        Set(
                            context: context,
                            ss: currentSs,
                            column: column,
                            dataRows: Groups(
                                context: context,
                                ss: currentSs,
                                inheritPermission: ss.InheritPermission,
                                searchText: searchText,
                                setAllChoices: setAllChoices,
                                offset: offset),
                            searchFormat: searchFormat);
                    }
                }
                break;

            case "Users":
                column.Type = Column.Types.User;
                if (setChoices)
                {
                    if (column.UseSearch != true || search || setAllChoices)
                    {
                        var currentSs = SiteSettingsUtilities.UsersSiteSettings(context: context);
                        Set(
                            context: context,
                            ss: currentSs,
                            column: column,
                            dataRows: Users(
                                context: context,
                                ss: currentSs,
                                inheritPermission: ss.InheritPermission,
                                searchText: searchText,
                                setAllChoices: setAllChoices,
                                offset: offset),
                            searchFormat: searchFormat);
                    }
                }
                break;

            default:
                if (setChoices)
                {
                    if (SiteId > 0)
                    {
                        if (column.UseSearch != true || search || setAllChoices)
                        {
                            var currentSs = ss.JoinedSsHash.Get(SiteId);
                            if (currentSs != null)
                            {
                                Set(
                                    context: context,
                                    ss: currentSs,
                                    column: column,
                                    dataRows: Items(
                                        context: context,
                                        ss: currentSs,
                                        searchText: searchText,
                                        parentColumn: parentColumn,
                                        parentIds: parentIds,
                                        offset: offset,
                                        setAllChoices: setAllChoices),
                                    searchFormat: searchFormat);
                            }
                        }
                    }
                }
                break;
            }
        }
Exemplo n.º 5
0
 public bool OverDeadline(Context context)
 {
     return(Deadline?.InRange() == true &&
            Deadline.ToDateTime() < DateTime.Now.ToLocal(context: context));
 }
Exemplo n.º 6
0
 public bool InitialValue(Context context)
 {
     return(this.ToJson() == "[]");
 }