示例#1
0
 public bool LogoType_Updated(Context context, Column column = null)
 {
     return(LogoType.ToInt() != SavedLogoType &&
            (column == null ||
             column.DefaultInput.IsNullOrEmpty() ||
             column.GetDefaultInput(context: context).ToInt() != LogoType.ToInt()));
 }
示例#2
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 "Ver":
                        Ver      = dataRow[column.ColumnName].ToInt();
                        SavedVer = Ver;
                        break;

                    case "TenantName":
                        TenantName      = dataRow[column.ColumnName].ToString();
                        SavedTenantName = TenantName;
                        break;

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

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

                    case "ContractSettings":
                        ContractSettings      = GetContractSettings(dataRow);
                        SavedContractSettings = ContractSettings?.RecordingJson();
                        break;

                    case "ContractDeadline":
                        ContractDeadline      = dataRow[column.ColumnName].ToDateTime();
                        SavedContractDeadline = ContractDeadline;
                        break;

                    case "DisableAllUsersPermission":
                        DisableAllUsersPermission      = dataRow[column.ColumnName].ToBool();
                        SavedDisableAllUsersPermission = DisableAllUsersPermission;
                        break;

                    case "DisableStartGuide":
                        DisableStartGuide      = dataRow[column.ColumnName].ToBool();
                        SavedDisableStartGuide = DisableStartGuide;
                        break;

                    case "LogoType":
                        LogoType      = (LogoTypes)dataRow[column.ColumnName].ToInt();
                        SavedLogoType = LogoType.ToInt();
                        break;

                    case "HtmlTitleTop":
                        HtmlTitleTop      = dataRow[column.ColumnName].ToString();
                        SavedHtmlTitleTop = HtmlTitleTop;
                        break;

                    case "HtmlTitleSite":
                        HtmlTitleSite      = dataRow[column.ColumnName].ToString();
                        SavedHtmlTitleSite = HtmlTitleSite;
                        break;

                    case "HtmlTitleRecord":
                        HtmlTitleRecord      = dataRow[column.ColumnName].ToString();
                        SavedHtmlTitleRecord = HtmlTitleRecord;
                        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(IContext 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 "Ver":
                        Ver      = dataRow[column.ColumnName].ToInt();
                        SavedVer = Ver;
                        break;

                    case "TenantName":
                        TenantName      = dataRow[column.ColumnName].ToString();
                        SavedTenantName = TenantName;
                        break;

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

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

                    case "ContractSettings":
                        ContractSettings      = GetContractSettings(dataRow);
                        SavedContractSettings = ContractSettings?.RecordingJson();
                        break;

                    case "ContractDeadline":
                        ContractDeadline      = dataRow[column.ColumnName].ToDateTime();
                        SavedContractDeadline = ContractDeadline;
                        break;

                    case "LogoType":
                        LogoType      = (LogoTypes)dataRow[column.ColumnName].ToInt();
                        SavedLogoType = LogoType.ToInt();
                        break;

                    case "HtmlTitleTop":
                        HtmlTitleTop      = dataRow[column.ColumnName].ToString();
                        SavedHtmlTitleTop = HtmlTitleTop;
                        break;

                    case "HtmlTitleSite":
                        HtmlTitleSite      = dataRow[column.ColumnName].ToString();
                        SavedHtmlTitleSite = HtmlTitleSite;
                        break;

                    case "HtmlTitleRecord":
                        HtmlTitleRecord      = dataRow[column.ColumnName].ToString();
                        SavedHtmlTitleRecord = HtmlTitleRecord;
                        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[column.ColumnName].ToBool() ? Versions.VerTypes.History : Versions.VerTypes.Latest; break;
                    }
                }
            }
        }