Exemplo n.º 1
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public PermissionModel(
     long referenceId,
     int deptId,
     int groupId,
     int userId,
     Permissions.Types permissionType)
 {
     ReferenceId = referenceId;
     if (deptId != 0)
     {
         DeptId   = deptId;
         DeptName = SiteInfo.Dept(DeptId).Name;
     }
     if (groupId != 0)
     {
         GroupId   = groupId;
         GroupName = new GroupModel(
             SiteSettingsUtilities.GroupsSiteSettings(), GroupId).GroupName;
     }
     if (userId != 0)
     {
         UserId = userId;
         var user = SiteInfo.User(UserId);
         Name = user.Name;
     }
     PermissionType = permissionType;
 }
Exemplo n.º 2
0
        public ControlData ControlData(Context context, SiteSettings ss, bool withType = true)
        {
            switch (Name)
            {
            case "Dept":
                var dept = SiteInfo.Dept(
                    tenantId: context.TenantId,
                    deptId: Id);
                return(DisplayText(
                           context: context,
                           text: Displays.Depts(context: context),
                           name: Id != 0
                            ? dept?.Name
                            : null,
                           title: dept?.Code,
                           withType: withType));

            case "Group":
                var groupModel = Id != 0
                        ? new GroupModel(
                    context: context,
                    ss: SiteSettingsUtilities.GroupsSiteSettings(context: context),
                    groupId: Id)
                        : null;
                return(DisplayText(
                           context: context,
                           text: Displays.Groups(context: context),
                           name: groupModel?.AccessStatus == Databases.AccessStatuses.Selected
                            ? groupModel.GroupName
                            : null,
                           title: null,
                           withType: withType));

            case "User":
                var user = SiteInfo.User(
                    context: context,
                    userId: Id);
                return(DisplayText(
                           context: context,
                           text: Displays.Users(context: context),
                           name: Id != 0
                            ? user?.Name
                            : null,
                           title: Id != 0
                            ? user?.LoginId
                            : null,
                           withType: withType));

            default:
                var column = ss?.GetColumn(
                    context: context,
                    columnName: Name);
                return(DisplayText(
                           context: context,
                           text: Displays.Column(context: context),
                           name: column?.LabelText,
                           title: column?.LabelTextDefault,
                           withType: withType));
            }
        }
Exemplo n.º 3
0
        public bool Exists(Context context)
        {
            if (Id == 0)
            {
                return(false);
            }
            switch (Name)
            {
            case "Dept":
                return(SiteInfo.Dept(
                           tenantId: context.TenantId,
                           deptId: Id) != null);

            case "Group":
                return(new GroupModel(
                           context: context,
                           ss: SiteSettingsUtilities.GroupsSiteSettings(context: context),
                           groupId: Id).AccessStatus == Databases.AccessStatuses.Selected);

            case "User":
                return(!SiteInfo.User(
                           context: context,
                           userId: Id).Anonymous());

            default:
                return(false);
            }
        }
Exemplo n.º 4
0
 public void SetBySession(bool empty = false)
 {
     LoginId = HttpContext.Current?.User?.Identity.Name;
     if (HttpContext.Current?.Session != null && !empty)
     {
         TenantId     = HttpContext.Current.Session["TenantId"].ToInt();
         DeptId       = HttpContext.Current.Session["DeptId"].ToInt();
         UserId       = HttpContext.Current.Session["UserId"].ToInt();
         Dept         = SiteInfo.Dept(tenantId: TenantId, deptId: DeptId);
         User         = SiteInfo.User(context: this, userId: UserId);
         Language     = HttpContext.Current.Session["Language"].ToStr();
         Developer    = HttpContext.Current.Session["Developer"].ToBool();
         TimeZoneInfo = HttpContext.Current.Session["TimeZoneInfo"] as TimeZoneInfo;
         RdsUser      = HttpContext.Current?.Session?["RdsUser"] as RdsUser;
         UserSettings = HttpContext.Current.Session["UserSettings"]?
                        .ToString()
                        .Deserialize <UserSettings>()
                        ?? new UserSettings();
         HasPrivilege = HttpContext.Current.Session["HasPrivilege"].ToBool();
         Controller   = GetController();
         Action       = GetAction();
         Id           = GetId();
         SetTenantCaches();
     }
 }
Exemplo n.º 5
0
 private void Set(UserModel userModel, bool setData)
 {
     if (userModel.AccessStatus == Databases.AccessStatuses.Selected)
     {
         Authenticated   = true;
         TenantId        = userModel.TenantId;
         DeptId          = userModel.DeptId;
         UserId          = userModel.UserId;
         Dept            = SiteInfo.Dept(tenantId: TenantId, deptId: DeptId);
         User            = SiteInfo.User(context: this, userId: UserId);
         Language        = userModel.Language;
         UserHostAddress = HttpContext.Current?.Request?.UserHostAddress;
         Developer       = userModel.Developer;
         TimeZoneInfo    = userModel.TimeZoneInfo;
         UserSettings    = userModel.UserSettings;
         HasPrivilege    = Permissions.PrivilegedUsers(loginId: userModel.LoginId);
         SetTenantCaches();
         SetContractSettings();
         SetPage();
         if (setData)
         {
             SetData();
         }
     }
 }
Exemplo n.º 6
0
 public static HtmlBuilder BurnDownRecordDetails(
     this HtmlBuilder hb,
     IContext context,
     IEnumerable <BurnDownElement> elements,
     Column progressRateColumn,
     Column statusColumn,
     int colspan,
     string unit)
 {
     return(hb.Tr(
                attributes: new HtmlAttributes()
                .Class("grid-row items"),
                action: () => hb
                .Td(attributes: new HtmlAttributes().Colspan(colspan),
                    action: () => elements
                    .Select(o => o.Updator)
                    .Distinct()
                    .ForEach(updatorId =>
                             hb.BurnDownRecordDetail(
                                 context: context,
                                 fullName: SiteInfo.User(
                                     context: context,
                                     userId: updatorId).Name,
                                 updatorId: updatorId,
                                 earndValue: elements
                                 .Where(o => o.Updator == updatorId)
                                 .Select(o => o.EarnedValueAdditions)
                                 .Sum(),
                                 elements: elements,
                                 progressRateColumn: progressRateColumn,
                                 statusColumn: statusColumn,
                                 unit: unit)))));
 }
Exemplo n.º 7
0
 private static HtmlBuilder DetailsHeader(
     this HtmlBuilder hb,
     IContext context,
     BurnDown burnDown,
     IEnumerable <int> updators,
     string ownerLabelText,
     Column column)
 {
     return(hb.Tr(css: "ui-widget-header", action: () =>
     {
         hb
         .Th(action: () => hb
             .Text(text: Displays.Date(context: context)))
         .Th(action: () => hb
             .Text(text: Displays.PlannedValue(context: context)))
         .Th(action: () => hb
             .Text(text: Displays.EarnedValue(context: context)))
         .Th(action: () => hb
             .Text(text: Displays.Difference(context: context)))
         .Th(action: () => hb
             .Text(text: ownerLabelText + " " + Displays.Total(context: context)));
         updators.ForEach(updatorId => hb
                          .Th(action: () => hb
                              .Text(text: SiteInfo.User(
                                        context: context,
                                        userId: updatorId).Name +
                                    " ({0})".Params(column.Display(
                                                        context: context,
                                                        value: burnDown
                                                        .Where(p => p.Updator == updatorId)
                                                        .Select(p => p.EarnedValueAdditions)
                                                        .Sum()) + column.Unit))));
     }));
 }
Exemplo n.º 8
0
 public void ReplaceRelatedUsers(Context context, List <int> users)
 {
     Address = Address.Replace(
         "[RelatedUsers]",
         Repository.ExecuteTable(
             context: context,
             statements: Rds.SelectMailAddresses(
                 column: Rds.MailAddressesColumn()
                 .OwnerId()
                 .MailAddress(),
                 where : Rds.MailAddressesWhere()
                 .OwnerId_In(users
                             .Distinct()
                             .Where(userId => SiteInfo.User(
                                        context: context,
                                        userId: userId).Id != SiteInfo.AnonymousId)
                             .Select(userId => userId.ToLong()))
                 .OwnerType("Users")))
         .AsEnumerable()
         .GroupBy(o => o["OwnerId"])
         .Select(o => MailAddressUtilities.Get(
                     SiteInfo.UserName(
                         context: context,
                         userId: o.First().Int("OwnerId")),
                     o.First()["MailAddress"].ToString()))
         .Join(";"));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public PermissionModel(
     Context context,
     long referenceId,
     int deptId,
     int groupId,
     int userId,
     Permissions.Types permissionType)
 {
     ReferenceId = referenceId;
     if (deptId != 0)
     {
         DeptId   = deptId;
         DeptName = SiteInfo.Dept(
             tenantId: context.TenantId,
             deptId: DeptId).Name;
     }
     if (groupId != 0)
     {
         GroupId   = groupId;
         GroupName = new GroupModel(
             context: context,
             ss: SiteSettingsUtilities.GroupsSiteSettings(context: context),
             groupId: GroupId)
                     .GroupName;
     }
     if (userId != 0)
     {
         UserId = userId;
         var user = SiteInfo.User(
             context: context,
             userId: UserId);
         Name = user.Name;
     }
     PermissionType = permissionType;
 }
Exemplo n.º 10
0
 public bool ContainsUser(int userId)
 {
     return(GroupUtilities.Contains(
                context: Context,
                groupId: GroupId,
                user: SiteInfo.User(
                    context: Context,
                    userId: userId.ToInt())));
 }
Exemplo n.º 11
0
 public bool ContainsUser(ServerScriptModelUserModel user)
 {
     return(GroupUtilities.Contains(
                context: Context,
                groupId: GroupId,
                user: SiteInfo.User(
                    context: Context,
                    userId: user?.UserId ?? 0)));
 }
Exemplo n.º 12
0
        private void Set(DataRow dataRow)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var name = dataColumn.ColumnName;
                switch (name)
                {
                case "ReferenceId": if (dataRow[name] != DBNull.Value)
                    {
                        ReferenceId = dataRow[name].ToLong(); SavedReferenceId = ReferenceId;
                    }
                    break;

                case "BinaryId": if (dataRow[name] != DBNull.Value)
                    {
                        BinaryId = dataRow[name].ToLong(); SavedBinaryId = BinaryId;
                    }
                    break;

                case "Ver": Ver = dataRow[name].ToInt(); SavedVer = Ver; break;

                case "BinaryType": BinaryType = dataRow[name].ToString(); SavedBinaryType = BinaryType; break;

                case "Title": Title = new Title(dataRow, "BinaryId"); SavedTitle = Title.Value; break;

                case "Body": Body = dataRow[name].ToString(); SavedBody = Body; break;

                case "Bin": Bin = dataRow.Bytes("Bin"); SavedBin = Bin; break;

                case "Thumbnail": Thumbnail = dataRow.Bytes("Bin"); SavedThumbnail = Thumbnail; break;

                case "Icon": Icon = dataRow.Bytes("Bin"); SavedIcon = Icon; break;

                case "FileName": FileName = dataRow[name].ToString(); SavedFileName = FileName; break;

                case "Extension": Extension = dataRow[name].ToString(); SavedExtension = Extension; break;

                case "Size": Size = dataRow[name].ToInt(); SavedSize = Size; break;

                case "BinarySettings": BinarySettings = dataRow.String("BinarySettings").Deserialize <BinarySettings>() ?? new BinarySettings(); SavedBinarySettings = BinarySettings.ToJson(); break;

                case "Comments": Comments = dataRow["Comments"].ToString().Deserialize <Comments>() ?? new Comments(); SavedComments = Comments.ToJson(); break;

                case "Creator": Creator = SiteInfo.User(dataRow.Int(name)); SavedCreator = Creator.Id; break;

                case "Updator": Updator = SiteInfo.User(dataRow.Int(name)); SavedUpdator = Updator.Id; break;

                case "CreatedTime": CreatedTime = new Time(dataRow, "CreatedTime"); SavedCreatedTime = CreatedTime.Value; break;

                case "UpdatedTime": UpdatedTime = new Time(dataRow, "UpdatedTime"); Timestamp = dataRow.Field <DateTime>("UpdatedTime").ToString("yyyy/M/d H:m:s.fff"); SavedUpdatedTime = UpdatedTime.Value; break;

                case "IsHistory": VerType = dataRow[name].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                }
            }
        }
Exemplo n.º 13
0
        private void Set(DataRow dataRow)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var name = dataColumn.ColumnName;
                switch (name)
                {
                case "ReferenceId": if (dataRow[name] != DBNull.Value)
                    {
                        ReferenceId = dataRow[name].ToLong(); SavedReferenceId = ReferenceId;
                    }
                    break;

                case "DeptId": if (dataRow[name] != DBNull.Value)
                    {
                        DeptId = dataRow[name].ToInt(); SavedDeptId = DeptId;
                    }
                    break;

                case "GroupId": if (dataRow[name] != DBNull.Value)
                    {
                        GroupId = dataRow[name].ToInt(); SavedGroupId = GroupId;
                    }
                    break;

                case "UserId": if (dataRow[name] != DBNull.Value)
                    {
                        UserId = dataRow[name].ToInt(); SavedUserId = UserId;
                    }
                    break;

                case "Ver": Ver = dataRow[name].ToInt(); SavedVer = Ver; break;

                case "DeptName": DeptName = dataRow[name].ToString(); SavedDeptName = DeptName; break;

                case "GroupName": GroupName = dataRow[name].ToString(); SavedGroupName = GroupName; break;

                case "Name": Name = dataRow[name].ToString(); SavedName = Name; break;

                case "PermissionType": PermissionType = (Permissions.Types)dataRow[name].ToLong(); SavedPermissionType = PermissionType.ToLong(); break;

                case "Comments": Comments = dataRow["Comments"].ToString().Deserialize <Comments>() ?? new Comments(); SavedComments = Comments.ToJson(); break;

                case "Creator": Creator = SiteInfo.User(dataRow.Int(name)); SavedCreator = Creator.Id; break;

                case "Updator": Updator = SiteInfo.User(dataRow.Int(name)); SavedUpdator = Updator.Id; break;

                case "CreatedTime": CreatedTime = new Time(dataRow, "CreatedTime"); SavedCreatedTime = CreatedTime.Value; break;

                case "UpdatedTime": UpdatedTime = new Time(dataRow, "UpdatedTime"); Timestamp = dataRow.Field <DateTime>("UpdatedTime").ToString("yyyy/M/d H:m:s.fff"); SavedUpdatedTime = UpdatedTime.Value; break;

                case "IsHistory": VerType = dataRow[name].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                }
            }
        }
 private static void SetResultModelValues(
     Context context,
     ResultModel resultModel,
     ExpandoObject data,
     Dictionary <string, Column> columns)
 {
     SetValue(
         columnName: nameof(ResultModel.Title),
         columns: columns,
         setter: value => resultModel.Title.Value = value,
         getter: column => String(
             data: data,
             columnName: column.ColumnName));
     SetValue(
         columnName: nameof(ResultModel.Body),
         columns: columns,
         setter: value => resultModel.Body = value,
         getter: column => String(
             data: data,
             columnName: column.ColumnName));
     SetValue(
         columnName: nameof(ResultModel.Status),
         columns: columns,
         setter: value => resultModel.Status.Value = value,
         getter: column => Int(
             data: data,
             name: column.ColumnName));
     SetValue(
         columnName: nameof(ResultModel.Manager),
         columns: columns,
         setter: value => resultModel.Manager = SiteInfo.User(
             context: context,
             userId: value),
         getter: column => Int(
             data: data,
             name: column.ColumnName));
     SetValue(
         columnName: nameof(ResultModel.Owner),
         columns: columns,
         setter: value => resultModel.Owner = SiteInfo.User(
             context: context,
             userId: value),
         getter: column => Int(
             data: data,
             name: column.ColumnName));
     SetValue(
         columnName: nameof(ResultModel.Locked),
         columns: columns,
         setter: value => resultModel.Locked = value,
         getter: column => Bool(
             data: data,
             name: column.Name));
 }
Exemplo n.º 15
0
 public string ToNotice(
     int saved,
     Column column,
     bool updated,
     bool update)
 {
     return(Name.ToNoticeLine(
                SiteInfo.User(saved).Name,
                column,
                updated,
                update));
 }
Exemplo n.º 16
0
        private void Set(DataRow dataRow)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var name = dataColumn.ColumnName;
                switch (name)
                {
                case "ReferenceType": if (dataRow[name] != DBNull.Value)
                    {
                        ReferenceType = dataRow[name].ToString(); SavedReferenceType = ReferenceType;
                    }
                    break;

                case "ReferenceId": if (dataRow[name] != DBNull.Value)
                    {
                        ReferenceId = dataRow[name].ToLong(); SavedReferenceId = ReferenceId;
                    }
                    break;

                case "Title": if (dataRow[name] != DBNull.Value)
                    {
                        Title = new Title(dataRow, "ExportSettingId"); SavedTitle = Title.Value;
                    }
                    break;

                case "ExportSettingId": if (dataRow[name] != DBNull.Value)
                    {
                        ExportSettingId = dataRow[name].ToLong(); SavedExportSettingId = ExportSettingId;
                    }
                    break;

                case "Ver": Ver = dataRow[name].ToInt(); SavedVer = Ver; break;

                case "AddHeader": AddHeader = dataRow[name].ToBool(); SavedAddHeader = AddHeader; break;

                case "ExportColumns": ExportColumns = dataRow.String("ExportColumns").Deserialize <ExportColumns>() ?? new ExportColumns(ReferenceType); SavedExportColumns = ExportColumns.ToJson(); break;

                case "Comments": Comments = dataRow["Comments"].ToString().Deserialize <Comments>() ?? new Comments(); SavedComments = Comments.ToJson(); break;

                case "Creator": Creator = SiteInfo.User(dataRow.Int(name)); SavedCreator = Creator.Id; break;

                case "Updator": Updator = SiteInfo.User(dataRow.Int(name)); SavedUpdator = Updator.Id; break;

                case "CreatedTime": CreatedTime = new Time(dataRow, "CreatedTime"); SavedCreatedTime = CreatedTime.Value; break;

                case "UpdatedTime": UpdatedTime = new Time(dataRow, "UpdatedTime"); Timestamp = dataRow.Field <DateTime>("UpdatedTime").ToString("yyyy/M/d H:m:s.fff"); SavedUpdatedTime = UpdatedTime.Value; break;

                case "IsHistory": VerType = dataRow[name].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                }
            }
        }
Exemplo n.º 17
0
        public ControlData ControlData(Context context, SiteSettings ss, bool withType = true)
        {
            var typeName = withType
                ? DisplayTypeName(context: context)
                : null;

            switch (Name)
            {
            case "Dept":
                var dept = SiteInfo.Dept(
                    tenantId: context.TenantId,
                    deptId: Id);
                return(new ControlData(
                           text: dept?.SelectableText(
                               context: context,
                               format: Parameters.Permissions.DeptFormat) + typeName,
                           title: dept?.Tooltip()));

            case "Group":
                var group = SiteInfo.Group(
                    tenantId: context.TenantId,
                    groupId: Id);
                return(new ControlData(
                           text: group?.SelectableText(
                               context: context,
                               format: Parameters.Permissions.GroupFormat) + typeName,
                           title: group?.Tooltip()));

            case "User":
                var user = SiteInfo.User(
                    context: context,
                    userId: Id);
                return(new ControlData(
                           text: user?.SelectableText(
                               context: context,
                               format: Parameters.Permissions.UserFormat) + typeName,
                           title: user?.Tooltip(context: context)));

            default:
                var column = ss?.GetColumn(
                    context: context,
                    columnName: Name);
                return(new ControlData(
                           id: Id,
                           text: Displays.Column(context: context),
                           name: column?.LabelText,
                           title: column?.LabelTextDefault,
                           typeName: typeName));
            }
        }
Exemplo n.º 18
0
        private void Set(SiteSettings ss, DataRow dataRow)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var name = dataColumn.ColumnName;
                switch (name)
                {
                case "SiteId": if (dataRow[name] != DBNull.Value)
                    {
                        SiteId = dataRow[name].ToLong(); SavedSiteId = SiteId;
                    }
                    break;

                case "UpdatedTime": if (dataRow[name] != DBNull.Value)
                    {
                        UpdatedTime = new Time(dataRow, "UpdatedTime"); Timestamp = dataRow.Field <DateTime>("UpdatedTime").ToString("yyyy/M/d H:m:s.fff"); SavedUpdatedTime = UpdatedTime.Value;
                    }
                    break;

                case "WikiId": if (dataRow[name] != DBNull.Value)
                    {
                        WikiId = dataRow[name].ToLong(); SavedWikiId = WikiId;
                    }
                    break;

                case "Ver": Ver = dataRow[name].ToInt(); SavedVer = Ver; break;

                case "Title": Title = new Title(dataRow, "WikiId"); SavedTitle = Title.Value; break;

                case "Body": Body = dataRow[name].ToString(); SavedBody = Body; break;

                case "Comments": Comments = dataRow["Comments"].ToString().Deserialize <Comments>() ?? new Comments(); SavedComments = Comments.ToJson(); break;

                case "Creator": Creator = SiteInfo.User(dataRow.Int(name)); SavedCreator = Creator.Id; break;

                case "Updator": Updator = SiteInfo.User(dataRow.Int(name)); SavedUpdator = Updator.Id; break;

                case "CreatedTime": CreatedTime = new Time(dataRow, "CreatedTime"); SavedCreatedTime = CreatedTime.Value; break;

                case "IsHistory": VerType = dataRow[name].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                }
            }
            if (ss != null)
            {
                Title.DisplayValue = WikiUtilities.TitleDisplayValue(ss, this);
            }
        }
Exemplo n.º 19
0
 public string ToNotice(
     Context context,
     int saved,
     Column column,
     bool updated,
     bool update)
 {
     return(Name.ToNoticeLine(
                context: context,
                saved: SiteInfo.User(
                    context: context,
                    userId: saved).Name,
                column: column,
                updated: updated,
                update: update));
 }
Exemplo n.º 20
0
        public ControlData ControlData(SiteSettings ss, bool withType = true)
        {
            switch (Name)
            {
            case "Dept":
                var dept = SiteInfo.Dept(Id);
                return(DisplayText(
                           Displays.Depts(),
                           Id != 0
                            ? dept?.Name
                            : null,
                           dept.Code,
                           withType));

            case "Group":
                var groupModel = Id != 0
                        ? new GroupModel(SiteSettingsUtilities.GroupsSiteSettings(), Id)
                        : null;
                return(DisplayText(
                           Displays.Groups(),
                           groupModel?.AccessStatus == Databases.AccessStatuses.Selected
                            ? groupModel.GroupName
                            : null,
                           null,
                           withType));

            case "User":
                var user = SiteInfo.User(Id);
                return(DisplayText(
                           Displays.Users(),
                           Id != 0
                            ? user?.Name
                            : null,
                           Id != 0
                            ? user?.LoginId
                            : null,
                           withType));

            default:
                var column = ss?.GetColumn(Name);
                return(DisplayText(
                           Displays.Column(),
                           column?.LabelText,
                           column?.LabelTextDefault,
                           withType));
            }
        }
Exemplo n.º 21
0
        private void Set(DataRow dataRow)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var name = dataColumn.ColumnName;
                switch (name)
                {
                case "DestinationId": if (dataRow[name] != DBNull.Value)
                    {
                        DestinationId = dataRow[name].ToLong(); SavedDestinationId = DestinationId;
                    }
                    break;

                case "SourceId": if (dataRow[name] != DBNull.Value)
                    {
                        SourceId = dataRow[name].ToLong(); SavedSourceId = SourceId;
                    }
                    break;

                case "Ver": Ver = dataRow[name].ToInt(); SavedVer = Ver; break;

                case "ReferenceType": ReferenceType = dataRow[name].ToString(); SavedReferenceType = ReferenceType; break;

                case "SiteId": SiteId = dataRow[name].ToLong(); SavedSiteId = SiteId; break;

                case "Title": Title = dataRow[name].ToString(); SavedTitle = Title; break;

                case "Subset": Subset = dataRow[name].ToString(); SavedSubset = Subset; break;

                case "SiteTitle": SiteTitle = dataRow[name].ToString(); SavedSiteTitle = SiteTitle; break;

                case "Comments": Comments = dataRow["Comments"].ToString().Deserialize <Comments>() ?? new Comments(); SavedComments = Comments.ToJson(); break;

                case "Creator": Creator = SiteInfo.User(dataRow.Int(name)); SavedCreator = Creator.Id; break;

                case "Updator": Updator = SiteInfo.User(dataRow.Int(name)); SavedUpdator = Updator.Id; break;

                case "CreatedTime": CreatedTime = new Time(dataRow, "CreatedTime"); SavedCreatedTime = CreatedTime.Value; break;

                case "UpdatedTime": UpdatedTime = new Time(dataRow, "UpdatedTime"); Timestamp = dataRow.Field <DateTime>("UpdatedTime").ToString("yyyy/M/d H:m:s.fff"); SavedUpdatedTime = UpdatedTime.Value; break;

                case "IsHistory": VerType = dataRow[name].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                }
            }
        }
Exemplo n.º 22
0
 public string ToNotice(
     Context context,
     int saved,
     Column column,
     NotificationColumnFormat notificationColumnFormat,
     bool updated,
     bool update)
 {
     return(notificationColumnFormat.DisplayText(
                self: Name,
                saved: SiteInfo.User(
                    context: context,
                    userId: saved).Name,
                column: column,
                updated: updated,
                update: update));
 }
        private void Set(DataRow dataRow)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var name = dataColumn.ColumnName;
                switch (name)
                {
                case "OwnerId": if (dataRow[name] != DBNull.Value)
                    {
                        OwnerId = dataRow[name].ToLong(); SavedOwnerId = OwnerId;
                    }
                    break;

                case "OwnerType": if (dataRow[name] != DBNull.Value)
                    {
                        OwnerType = dataRow[name].ToString(); SavedOwnerType = OwnerType;
                    }
                    break;

                case "MailAddressId": if (dataRow[name] != DBNull.Value)
                    {
                        MailAddressId = dataRow[name].ToLong(); SavedMailAddressId = MailAddressId;
                    }
                    break;

                case "Ver": Ver = dataRow[name].ToInt(); SavedVer = Ver; break;

                case "MailAddress": MailAddress = dataRow[name].ToString(); SavedMailAddress = MailAddress; break;

                case "Comments": Comments = dataRow["Comments"].ToString().Deserialize <Comments>() ?? new Comments(); SavedComments = Comments.ToJson(); break;

                case "Creator": Creator = SiteInfo.User(dataRow.Int(name)); SavedCreator = Creator.Id; break;

                case "Updator": Updator = SiteInfo.User(dataRow.Int(name)); SavedUpdator = Updator.Id; break;

                case "CreatedTime": CreatedTime = new Time(dataRow, "CreatedTime"); SavedCreatedTime = CreatedTime.Value; break;

                case "UpdatedTime": UpdatedTime = new Time(dataRow, "UpdatedTime"); Timestamp = dataRow.Field <DateTime>("UpdatedTime").ToString("yyyy/M/d H:m:s.fff"); SavedUpdatedTime = UpdatedTime.Value; break;

                case "IsHistory": VerType = dataRow[name].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                }
            }
        }
Exemplo n.º 24
0
        private void Set(SiteSettings ss, DataRow dataRow)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var name = dataColumn.ColumnName;
                switch (name)
                {
                case "TenantId": if (dataRow[name] != DBNull.Value)
                    {
                        TenantId = dataRow[name].ToInt(); SavedTenantId = TenantId;
                    }
                    break;

                case "DeptId": if (dataRow[name] != DBNull.Value)
                    {
                        DeptId = dataRow[name].ToInt(); SavedDeptId = DeptId;
                    }
                    break;

                case "Ver": Ver = dataRow[name].ToInt(); SavedVer = Ver; break;

                case "DeptCode": DeptCode = dataRow[name].ToString(); SavedDeptCode = DeptCode; break;

                case "DeptName": DeptName = dataRow[name].ToString(); SavedDeptName = DeptName; break;

                case "Body": Body = dataRow[name].ToString(); SavedBody = Body; break;

                case "Comments": Comments = dataRow["Comments"].ToString().Deserialize <Comments>() ?? new Comments(); SavedComments = Comments.ToJson(); break;

                case "Creator": Creator = SiteInfo.User(dataRow.Int(name)); SavedCreator = Creator.Id; break;

                case "Updator": Updator = SiteInfo.User(dataRow.Int(name)); SavedUpdator = Updator.Id; break;

                case "CreatedTime": CreatedTime = new Time(dataRow, "CreatedTime"); SavedCreatedTime = CreatedTime.Value; break;

                case "UpdatedTime": UpdatedTime = new Time(dataRow, "UpdatedTime"); Timestamp = dataRow.Field <DateTime>("UpdatedTime").ToString("yyyy/M/d H:m:s.fff"); SavedUpdatedTime = UpdatedTime.Value; break;

                case "IsHistory": VerType = dataRow[name].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                }
            }
        }
Exemplo n.º 25
0
 public TimeSeriesElement(
     bool userColumn,
     long id,
     int ver,
     DateTime updatedTime,
     string index,
     decimal value,
     bool isHistory)
 {
     Id          = id;
     Ver         = ver;
     UpdatedTime = updatedTime;
     Index       = userColumn && SiteInfo.User(index.ToInt()).Anonymous()
         ? "\t"
         : index == string.Empty
             ? "\t"
             : index;
     Value     = value;
     IsHistory = isHistory;
 }
Exemplo n.º 26
0
            public ServerScriptModelUserModel Get(object id)
            {
                var user = SiteInfo.User(
                    context: Context,
                    userId: id.ToInt());
                var userModel = !user.Anonymous()
                    ? new ServerScriptModelUserModel(
                    context: Context,
                    tenantId: user.TenantId,
                    userId: user.Id,
                    deptId: user.DeptId,
                    loginId: user.LoginId,
                    name: user.Name,
                    userCode: user.UserCode,
                    tenantManager: user.TenantManager,
                    serviceManager: user.ServiceManager,
                    disabled: user.Disabled)
                    : null;

                return(userModel);
            }
Exemplo n.º 27
0
        private void Set(DataRow dataRow)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var name = dataColumn.ColumnName;
                switch (name)
                {
                case "HealthId": if (dataRow[name] != DBNull.Value)
                    {
                        HealthId = dataRow[name].ToLong(); SavedHealthId = HealthId;
                    }
                    break;

                case "Ver": Ver = dataRow[name].ToInt(); SavedVer = Ver; break;

                case "TenantCount": TenantCount = dataRow[name].ToInt(); SavedTenantCount = TenantCount; break;

                case "UserCount": UserCount = dataRow[name].ToInt(); SavedUserCount = UserCount; break;

                case "ItemCount": ItemCount = dataRow[name].ToInt(); SavedItemCount = ItemCount; break;

                case "ErrorCount": ErrorCount = dataRow[name].ToInt(); SavedErrorCount = ErrorCount; break;

                case "Elapsed": Elapsed = dataRow[name].ToDouble(); SavedElapsed = Elapsed; break;

                case "Comments": Comments = dataRow["Comments"].ToString().Deserialize <Comments>() ?? new Comments(); SavedComments = Comments.ToJson(); break;

                case "Creator": Creator = SiteInfo.User(dataRow.Int(name)); SavedCreator = Creator.Id; break;

                case "Updator": Updator = SiteInfo.User(dataRow.Int(name)); SavedUpdator = Updator.Id; break;

                case "CreatedTime": CreatedTime = new Time(dataRow, "CreatedTime"); SavedCreatedTime = CreatedTime.Value; break;

                case "UpdatedTime": UpdatedTime = new Time(dataRow, "UpdatedTime"); Timestamp = dataRow.Field <DateTime>("UpdatedTime").ToString("yyyy/M/d H:m:s.fff"); SavedUpdatedTime = UpdatedTime.Value; break;

                case "IsHistory": VerType = dataRow[name].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                }
            }
        }
Exemplo n.º 28
0
        private void Set(DataRow dataRow)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var name = dataColumn.ColumnName;
                switch (name)
                {
                case "ReferenceId": if (dataRow[name] != DBNull.Value)
                    {
                        ReferenceId = dataRow[name].ToLong(); SavedReferenceId = ReferenceId;
                    }
                    break;

                case "Ver": Ver = dataRow[name].ToInt(); SavedVer = Ver; break;

                case "ReferenceType": ReferenceType = dataRow[name].ToString(); SavedReferenceType = ReferenceType; break;

                case "SiteId": SiteId = dataRow[name].ToLong(); SavedSiteId = SiteId; break;

                case "Title": Title = dataRow[name].ToString(); SavedTitle = Title; break;

                case "FullText": FullText = dataRow[name].ToString(); SavedFullText = FullText; break;

                case "SearchIndexCreatedTime": SearchIndexCreatedTime = dataRow[name].ToDateTime(); SavedSearchIndexCreatedTime = SearchIndexCreatedTime; break;

                case "Comments": Comments = dataRow["Comments"].ToString().Deserialize <Comments>() ?? new Comments(); SavedComments = Comments.ToJson(); break;

                case "Creator": Creator = SiteInfo.User(dataRow.Int(name)); SavedCreator = Creator.Id; break;

                case "Updator": Updator = SiteInfo.User(dataRow.Int(name)); SavedUpdator = Updator.Id; break;

                case "CreatedTime": CreatedTime = new Time(dataRow, "CreatedTime"); SavedCreatedTime = CreatedTime.Value; break;

                case "UpdatedTime": UpdatedTime = new Time(dataRow, "UpdatedTime"); SavedUpdatedTime = UpdatedTime.Value; break;

                case "IsHistory": VerType = dataRow[name].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                }
            }
        }
Exemplo n.º 29
0
        private void Set(Context context, SiteSettings ss, DataRow dataRow, string tableAlias = null)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var column = new ColumnNameInfo(dataColumn.ColumnName);
                if (column.TableAlias == tableAlias)
                {
                    switch (column.Name)
                    {
                    case "TenantId":
                        if (dataRow[column.ColumnName] != DBNull.Value)
                        {
                            TenantId      = dataRow[column.ColumnName].ToInt();
                            SavedTenantId = TenantId;
                        }
                        break;

                    case "DeptId":
                        if (dataRow[column.ColumnName] != DBNull.Value)
                        {
                            DeptId      = dataRow[column.ColumnName].ToInt();
                            SavedDeptId = DeptId;
                        }
                        break;

                    case "Ver":
                        Ver      = dataRow[column.ColumnName].ToInt();
                        SavedVer = Ver;
                        break;

                    case "DeptCode":
                        DeptCode      = dataRow[column.ColumnName].ToString();
                        SavedDeptCode = DeptCode;
                        break;

                    case "DeptName":
                        DeptName      = dataRow[column.ColumnName].ToString();
                        SavedDeptName = DeptName;
                        break;

                    case "Body":
                        Body      = dataRow[column.ColumnName].ToString();
                        SavedBody = Body;
                        break;

                    case "Comments":
                        Comments      = dataRow[column.ColumnName].ToString().Deserialize <Comments>() ?? new Comments();
                        SavedComments = Comments.ToJson();
                        break;

                    case "Creator":
                        Creator      = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName));
                        SavedCreator = Creator.Id;
                        break;

                    case "Updator":
                        Updator      = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName));
                        SavedUpdator = Updator.Id;
                        break;

                    case "CreatedTime":
                        CreatedTime      = new Time(context, dataRow, column.ColumnName);
                        SavedCreatedTime = CreatedTime.Value;
                        break;

                    case "UpdatedTime":
                        UpdatedTime      = new Time(context, dataRow, column.ColumnName); Timestamp = dataRow.Field <DateTime>(column.ColumnName).ToString("yyyy/M/d H:m:s.fff");
                        SavedUpdatedTime = UpdatedTime.Value;
                        break;

                    case "IsHistory":
                        VerType = dataRow.Bool(column.ColumnName)
                                ? Versions.VerTypes.History
                                : Versions.VerTypes.Latest; break;

                    default:
                        switch (Def.ExtendedColumnTypes.Get(column.Name))
                        {
                        case "Class":
                            Class(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToString());
                            SavedClass(
                                columnName: column.Name,
                                value: Class(columnName: column.Name));
                            break;

                        case "Num":
                            Num(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToDecimal());
                            SavedNum(
                                columnName: column.Name,
                                value: Num(columnName: column.Name));
                            break;

                        case "Date":
                            Date(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToDateTime());
                            SavedDate(
                                columnName: column.Name,
                                value: Date(columnName: column.Name));
                            break;

                        case "Description":
                            Description(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToString());
                            SavedDescription(
                                columnName: column.Name,
                                value: Description(columnName: column.Name));
                            break;

                        case "Check":
                            Check(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToBool());
                            SavedCheck(
                                columnName: column.Name,
                                value: Check(columnName: column.Name));
                            break;

                        case "Attachments":
                            Attachments(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToString()
                                .Deserialize <Attachments>() ?? new Attachments());
                            SavedAttachments(
                                columnName: column.Name,
                                value: Attachments(columnName: column.Name).ToJson());
                            break;
                        }
                        break;
                    }
                }
            }
        }
        private void Set(Context context, SiteSettings ss, DataRow dataRow, string tableAlias = null)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var column = new ColumnNameInfo(dataColumn.ColumnName);
                if (column.TableAlias == tableAlias)
                {
                    switch (column.Name)
                    {
                    case "TenantId":
                        if (dataRow[column.ColumnName] != DBNull.Value)
                        {
                            TenantId      = dataRow[column.ColumnName].ToInt();
                            SavedTenantId = TenantId;
                        }
                        break;

                    case "RegistrationId":
                        if (dataRow[column.ColumnName] != DBNull.Value)
                        {
                            RegistrationId      = dataRow[column.ColumnName].ToInt();
                            SavedRegistrationId = RegistrationId;
                        }
                        break;

                    case "Ver":
                        Ver      = dataRow[column.ColumnName].ToInt();
                        SavedVer = Ver;
                        break;

                    case "MailAddress":
                        MailAddress      = dataRow[column.ColumnName].ToString();
                        SavedMailAddress = MailAddress;
                        break;

                    case "Invitee":
                        Invitee      = dataRow[column.ColumnName].ToInt();
                        SavedInvitee = Invitee;
                        break;

                    case "InviteeName":
                        InviteeName      = dataRow[column.ColumnName].ToString();
                        SavedInviteeName = InviteeName;
                        break;

                    case "LoginId":
                        LoginId      = dataRow[column.ColumnName].ToString();
                        SavedLoginId = LoginId;
                        break;

                    case "Name":
                        Name      = dataRow[column.ColumnName].ToString();
                        SavedName = Name;
                        break;

                    case "Password":
                        Password      = dataRow[column.ColumnName].ToString();
                        SavedPassword = Password;
                        break;

                    case "Language":
                        Language      = dataRow[column.ColumnName].ToString();
                        SavedLanguage = Language;
                        break;

                    case "Passphrase":
                        Passphrase      = dataRow[column.ColumnName].ToString();
                        SavedPassphrase = Passphrase;
                        break;

                    case "Invitingflg":
                        Invitingflg      = dataRow[column.ColumnName].ToString();
                        SavedInvitingflg = Invitingflg;
                        break;

                    case "UserId":
                        UserId      = dataRow[column.ColumnName].ToInt();
                        SavedUserId = UserId;
                        break;

                    case "DeptId":
                        DeptId      = dataRow[column.ColumnName].ToInt();
                        SavedDeptId = DeptId;
                        break;

                    case "GroupId":
                        GroupId      = dataRow[column.ColumnName].ToInt();
                        SavedGroupId = GroupId;
                        break;

                    case "Comments":
                        Comments      = dataRow[column.ColumnName].ToString().Deserialize <Comments>() ?? new Comments();
                        SavedComments = Comments.ToJson();
                        break;

                    case "Creator":
                        Creator      = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName));
                        SavedCreator = Creator.Id;
                        break;

                    case "Updator":
                        Updator      = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName));
                        SavedUpdator = Updator.Id;
                        break;

                    case "CreatedTime":
                        CreatedTime      = new Time(context, dataRow, column.ColumnName);
                        SavedCreatedTime = CreatedTime.Value;
                        break;

                    case "UpdatedTime":
                        UpdatedTime      = new Time(context, dataRow, column.ColumnName); Timestamp = dataRow.Field <DateTime>(column.ColumnName).ToString("yyyy/M/d H:m:s.fff");
                        SavedUpdatedTime = UpdatedTime.Value;
                        break;

                    case "IsHistory":
                        VerType = dataRow.Bool(column.ColumnName)
                                ? Versions.VerTypes.History
                                : Versions.VerTypes.Latest; break;

                    default:
                        switch (Def.ExtendedColumnTypes.Get(column.Name))
                        {
                        case "Class":
                            Class(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToString());
                            SavedClass(
                                columnName: column.Name,
                                value: Class(columnName: column.Name));
                            break;

                        case "Num":
                            Num(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToDecimal());
                            SavedNum(
                                columnName: column.Name,
                                value: Num(columnName: column.Name));
                            break;

                        case "Date":
                            Date(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToDateTime());
                            SavedDate(
                                columnName: column.Name,
                                value: Date(columnName: column.Name));
                            break;

                        case "Description":
                            Description(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToString());
                            SavedDescription(
                                columnName: column.Name,
                                value: Description(columnName: column.Name));
                            break;

                        case "Check":
                            Check(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToBool());
                            SavedCheck(
                                columnName: column.Name,
                                value: Check(columnName: column.Name));
                            break;

                        case "Attachments":
                            Attachments(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToString()
                                .Deserialize <Attachments>() ?? new Attachments());
                            SavedAttachments(
                                columnName: column.Name,
                                value: Attachments(columnName: column.Name).ToJson());
                            break;
                        }
                        break;
                    }
                }
            }
        }