Пример #1
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public static string MultiUpload(System.Web.HttpPostedFileBase[] files, long id)
        {
            var controlId   = Forms.ControlId();
            var ss          = new ItemModel(id).GetSite(initSiteSettings: true).SiteSettings;
            var column      = ss.GetColumn(Forms.Data("ColumnName"));
            var attachments = Forms.Data("AttachmentsData").Deserialize <Attachments>();
            var invalid     = BinaryValidators.OnUploading(column, attachments, files);

            switch (invalid)
            {
            case Error.Types.OverLimitQuantity:
                return(Messages.ResponseOverLimitQuantity(
                           column.LimitQuantity.ToString()).ToJson());

            case Error.Types.OverLimitSize:
                return(Messages.ResponseOverLimitSize(
                           column.LimitSize.ToString()).ToJson());

            case Error.Types.OverTotalLimitSize:
                return(Messages.ResponseOverTotalLimitSize(
                           column.TotalLimitSize.ToString()).ToJson());

            case Error.Types.OverTenantStorageSize:
                return(Messages.ResponseOverTenantStorageSize(
                           Contract.TenantStorageSize().ToString()).ToJson());

            case Error.Types.None: break;

            default: return(invalid.MessageJson());
            }
            files.ForEach(file => attachments.Add(new Attachment()
            {
                Guid        = file.WriteToTemp(),
                Name        = file.FileName.Split('\\').Last(),
                Size        = file.ContentLength,
                Extention   = file.Extension(),
                ContentType = file.ContentType,
                Added       = true,
                Deleted     = false
            }));
            var hb = new HtmlBuilder();

            return(new ResponseCollection()
                   .ReplaceAll($"#{controlId}Field", new HtmlBuilder()
                               .Field(
                                   ss: ss,
                                   column: column,
                                   value: attachments.ToJson(),
                                   columnPermissionType: column.ColumnPermissionType()))
                   .SetData("#" + controlId)
                   .ToJson());
        }
Пример #2
0
        private string String(string controlId)
        {
            var data = Forms.Data(controlId);

            if (data != string.Empty)
            {
                return(data);
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
 public static ResponseCollection PrependComment(
     this ResponseCollection res,
     Comments comments,
     Versions.VerTypes verType)
 {
     return(Forms.Data("Comments").Trim() != string.Empty
         ? res
            .Val("#Comments", string.Empty)
            .Focus("#Comments")
            .Prepend("#CommentList", new HtmlBuilder()
                     .Comment(comment: comments[0], verType: verType))
         : res);
 }
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "OutgoingMails_To": To = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Cc": Cc = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Bcc": Bcc = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Title": Title = new Title(OutgoingMailId, Forms.Data(controlId)); break;

                case "OutgoingMails_Body": Body = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_SentTime": SentTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "OutgoingMails_DestinationSearchRange": DestinationSearchRange = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_DestinationSearchText": DestinationSearchText = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Пример #5
0
        /// <summary>
        /// Fixed:
        /// </summary>
        private static Dictionary <string, ControlData> SelectableMembers()
        {
            var data       = new Dictionary <string, ControlData>();
            var searchText = Forms.Data("SearchMemberText");

            if (!searchText.IsNullOrEmpty())
            {
                var currentMembers = Forms.List("CurrentMembersAll");
                Rds.ExecuteTable(statements: new SqlStatement[]
                {
                    Rds.SelectDepts(
                        column: Rds.DeptsColumn()
                        .DeptId()
                        .Add("0 as [UserId]"),
                        where : Rds.DeptsWhere()
                        .TenantId(Sessions.TenantId())
                        .DeptId_In(
                            currentMembers?
                            .Where(o => o.StartsWith("Dept,"))
                            .Select(o => o.Split_2nd().ToInt()),
                            negative: true)
                        .SqlWhereLike(
                            searchText,
                            Rds.Depts_DeptId_WhereLike(),
                            Rds.Depts_DeptCode_WhereLike(),
                            Rds.Depts_DeptName_WhereLike())),
                    Rds.SelectUsers(
                        unionType: Sqls.UnionTypes.Union,
                        column: Rds.UsersColumn()
                        .Add("0 as [DeptId]")
                        .UserId(),
                        where : Rds.UsersWhere()
                        .TenantId(Sessions.TenantId())
                        .UserId_In(
                            currentMembers?
                            .Where(o => o.StartsWith("User,"))
                            .Select(o => o.Split_2nd().ToInt()),
                            negative: true)
                        .SqlWhereLike(
                            searchText,
                            Rds.Users_LoginId_WhereLike(),
                            Rds.Users_UserId_WhereLike(),
                            Rds.Users_Name_WhereLike()))
                })
                .AsEnumerable()
                .ForEach(dataRow =>
                         data.AddMember(dataRow));
            }
            return(data);
        }
Пример #6
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public void SetByForm(Context context)
        {
            var ss = SiteSettingsUtilities.OutgoingMailsSiteSettings(context: context);

            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "OutgoingMails_To": To = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Cc": Cc = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Bcc": Bcc = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Title": Title = new Title(OutgoingMailId, Forms.Data(controlId)); break;

                case "OutgoingMails_Body": Body = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_SentTime": SentTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "OutgoingMails_DestinationSearchRange": DestinationSearchRange = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_DestinationSearchText": DestinationSearchText = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments":
                    Comments.Prepend(
                        context: context,
                        ss: new SiteSettings(),
                        body: Forms.Data("Comments"));
                    break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            context: context,
                            ss: ss,
                            commentId: controlId.Substring("Comment".Length).ToInt(),
                            body: Forms.Data(controlId));
                    }
                    break;
                }
            });
        }
Пример #7
0
        public string SearchDropDown()
        {
            SetSite();
            var controlId  = Forms.Data("DropDownSearchTarget");
            var searchText = Forms.Data("DropDownSearchText");
            var column     = SearchDropDownColumn(controlId, searchText);

            return(new ResponseCollection()
                   .ReplaceAll(
                       "#DropDownSearchResults",
                       new HtmlBuilder().Selectable(
                           controlId: "DropDownSearchResults",
                           listItemCollection: column?.EditChoices(addNotSet: true)))
                   .ClearFormData("DropDownSearchResults")
                   .ToJson());
        }
Пример #8
0
        public static string RestoreFromHistory(SiteSettings ss, long wikiId)
        {
            if (!Parameters.History.Restore)
            {
                return(Error.Types.InvalidRequest.MessageJson());
            }
            var wikiModel = new WikiModel(ss, wikiId);
            var invalid   = WikiValidators.OnUpdating(ss, wikiModel);

            switch (invalid)
            {
            case Error.Types.None: break;

            default: return(invalid.MessageJson());
            }
            var ver = Forms.Data("GridCheckedItems")
                      .Split(',')
                      .Where(o => !o.IsNullOrEmpty())
                      .ToList();

            if (ver.Count() != 1)
            {
                return(Error.Types.SelectOne.MessageJson());
            }
            wikiModel.SetByModel(new WikiModel().Get(
                                     ss: ss,
                                     tableType: Sqls.TableTypes.History,
                                     where : Rds.WikisWhere()
                                     .SiteId(ss.SiteId)
                                     .WikiId(wikiId)
                                     .Ver(ver.First())));
            wikiModel.VerUp = true;
            var error = wikiModel.Update(ss, otherInitValue: true);

            switch (error)
            {
            case Error.Types.None:
                Sessions.Set("Message", Messages.RestoredFromHistory(ver.First().ToString()));
                return(new ResponseCollection()
                       .SetMemory("formChanged", false)
                       .Href(Locations.ItemEdit(wikiId))
                       .ToJson());

            default:
                return(error.MessageJson());
            }
        }
Пример #9
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Demos_TenantId": TenantId = Forms.Data(controlId).ToInt(); break;

                case "Demos_Title": Title = new Title(DemoId, Forms.Data(controlId)); break;

                case "Demos_Passphrase": Passphrase = Forms.Data(controlId).ToString(); break;

                case "Demos_MailAddress": MailAddress = Forms.Data(controlId).ToString(); break;

                case "Demos_Initialized": Initialized = Forms.Data(controlId).ToBool(); break;

                case "Demos_TimeLag": TimeLag = Forms.Data(controlId).ToInt(); break;

                case "Demos_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Пример #10
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Binaries_ReferenceId": ReferenceId = Forms.Data(controlId).ToLong(); break;

                case "Binaries_BinaryType": BinaryType = Forms.Data(controlId).ToString(); break;

                case "Binaries_Title": Title = new Title(BinaryId, Forms.Data(controlId)); break;

                case "Binaries_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Binaries_FileName": FileName = Forms.Data(controlId).ToString(); break;

                case "Binaries_Extension": Extension = Forms.Data(controlId).ToString(); break;

                case "Binaries_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default: break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Binaries_Bin": Bin = Forms.File(controlId); break;

                case "Binaries_Thumbnail": Thumbnail = Forms.File(controlId); break;

                case "Binaries_Icon": Icon = Forms.File(controlId); break;

                default: break;
                }
            });
        }
Пример #11
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Healths_TenantCount": TenantCount = Forms.Data(controlId).ToInt(); break;

                case "Healths_UserCount": UserCount = Forms.Data(controlId).ToInt(); break;

                case "Healths_ItemCount": ItemCount = Forms.Data(controlId).ToInt(); break;

                case "Healths_ErrorCount": ErrorCount = Forms.Data(controlId).ToInt(); break;

                case "Healths_Elapsed": Elapsed = Forms.Data(controlId).ToDouble(); break;

                case "Healths_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "ExportSettings_ReferenceType": ReferenceType = Forms.Data(controlId).ToString(); break;

                case "ExportSettings_ReferenceId": ReferenceId = Forms.Data(controlId).ToLong(); break;

                case "ExportSettings_Title": Title = new Title(ExportSettingId, Forms.Data(controlId)); break;

                case "ExportSettings_AddHeader": AddHeader = Forms.Data(controlId).ToBool(); break;

                case "ExportSettings_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Пример #13
0
        public void SetByForm(Context context, SiteSettings ss)
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Depts_DeptCode": DeptCode = Forms.Data(controlId).ToString(); break;

                case "Depts_DeptName": DeptName = Forms.Data(controlId).ToString(); break;

                case "Depts_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Depts_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(context: context, ss: ss, body: Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            context: context,
                            ss: ss,
                            commentId: controlId.Substring("Comment".Length).ToInt(),
                            body: Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (context.Action == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Пример #14
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Tenants_TenantName": TenantName = Forms.Data(controlId).ToString(); break;

                case "Tenants_Title": Title = new Title(TenantId, Forms.Data(controlId)); break;

                case "Tenants_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Tenants_ContractDeadline": ContractDeadline = Forms.Data(controlId).ToDateTime().ToUniversal(); break;

                case "Tenants_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Пример #15
0
 public static ResponseCollection PrependComment(
     this ResponseCollection res,
     SiteSettings ss,
     Column column,
     Comments comments,
     Versions.VerTypes verType)
 {
     return(Forms.Data("Comments").Trim() != string.Empty
         ? res
            .Val("#Comments", string.Empty)
            .Focus("#Comments")
            .Prepend("#CommentList", new HtmlBuilder()
                     .Comment(
                         ss: ss,
                         column: column,
                         comment: comments[0],
                         readOnly: false))
         : res);
 }
Пример #16
0
        public string SearchDropDown()
        {
            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());
            return(new ResponseCollection()
                   .ReplaceAll(
                       "#DropDownSearchResults",
                       new HtmlBuilder().Selectable(
                           controlId: "DropDownSearchResults",
                           listItemCollection: column?.EditChoices()))
                   .ClearFormData("DropDownSearchResults")
                   .ToJson());
        }
Пример #17
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "MailAddresses_OwnerId": OwnerId = Forms.Data(controlId).ToLong(); break;

                case "MailAddresses_OwnerType": OwnerType = Forms.Data(controlId).ToString(); break;

                case "MailAddresses_MailAddress": MailAddress = Forms.Data(controlId).ToString(); break;

                case "MailAddresses_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Пример #18
0
        public void SetByForm(SiteSettings ss)
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Groups_TenantId": TenantId = Forms.Data(controlId).ToInt(); break;

                case "Groups_GroupName": GroupName = Forms.Data(controlId).ToString(); break;

                case "Groups_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Groups_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Пример #19
0
        private static string ToDefault(this string self, SiteSettings ss, Column column)
        {
            if (IsLinked(ss, column))
            {
                var id = Forms.Data("LinkId");
                if (column.UseSearch == true)
                {
                    ss.SetChoiceHash(
                        columnName: column?.ColumnName,
                        selectedValues: new List <string>()
                    {
                        id
                    });
                }
                return(id);
            }
            if (column.DefaultInput != string.Empty)
            {
                switch (column.TypeName.CsTypeSummary())
                {
                case Types.CsBool:
                    return(column.DefaultInput.ToBool().ToOneOrZeroString());

                case Types.CsNumeric:
                    return(column.DefaultInput.ToLong().ToString());

                case Types.CsDateTime:
                    return(!self.ToDateTime().InRange()
                            ? DateTime.Now
                           .ToLocal()
                           .AddDays(column.DefaultInput.ToInt())
                           .ToString(Displays.Get(column.EditorFormat + "Format"))
                            : self);

                default:
                    return(column.DefaultInput);
                }
            }
            return(self);
        }
Пример #20
0
        public static Error.Types SetReminder(out string data)
        {
            data = null;
            var badFrom = MailAddressValidators.BadMailAddress(
                Forms.Data("ReminderFrom"), out data);

            if (badFrom != Error.Types.None)
            {
                return(badFrom);
            }
            var badTo = MailAddressValidators.BadMailAddress(
                Forms.Data("ReminderTo"), out data);

            if (badTo != Error.Types.None)
            {
                return(badTo);
            }
            var externalTo = MailAddressValidators.ExternalMailAddress(
                Forms.Data("ReminderTo"), out data);

            return(Error.Types.None);
        }
Пример #21
0
        private Column SearchDropDownColumn(string controlId, string searchText)
        {
            var ss     = SiteSettingsUtilities.Get(Site, ReferenceId, setSiteIntegration: true);
            var column = ss.GetColumn(controlId.Substring(
                                          controlId.StartsWith("ViewFilters__")
                    ? "ViewFilters__".Length
                    : (ss.ReferenceType + "_").Length));

            if (column?.Linked() == true)
            {
                column?.SetChoiceHash(
                    siteId: column.SiteId,
                    linkHash: column.SiteSettings.LinkHash(column.Name, searchText),
                    searchIndexes: searchText.SearchIndexes());
            }
            else
            {
                ss.SetChoiceHash(
                    columnName: column?.ColumnName,
                    searchText: Forms.Data("DropDownSearchText"));
            }
            return(column);
        }
Пример #22
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Templates_Title": Title = Forms.Data(controlId).ToString(); break;

                case "Templates_Standard": Standard = Forms.Data(controlId).ToBool(); break;

                case "Templates_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Templates_SiteSettingsTemplate": SiteSettingsTemplate = Forms.Data(controlId).ToString(); break;

                case "Templates_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default: break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Пример #23
0
        public void SetByForm(SiteSettings ss)
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Users_LoginId": LoginId = Forms.Data(controlId).ToString(); break;

                case "Users_GlobalId": GlobalId = Forms.Data(controlId).ToString(); break;

                case "Users_Name": Name = Forms.Data(controlId).ToString(); break;

                case "Users_UserCode": UserCode = Forms.Data(controlId).ToString(); break;

                case "Users_Password": Password = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_PasswordValidate": PasswordValidate = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_PasswordDummy": PasswordDummy = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_RememberMe": RememberMe = Forms.Data(controlId).ToBool(); break;

                case "Users_LastName": LastName = Forms.Data(controlId).ToString(); break;

                case "Users_FirstName": FirstName = Forms.Data(controlId).ToString(); break;

                case "Users_Birthday": Birthday = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "Users_Gender": Gender = Forms.Data(controlId).ToString(); break;

                case "Users_Language": Language = Forms.Data(controlId).ToString(); break;

                case "Users_TimeZone": TimeZone = Forms.Data(controlId).ToString(); break;

                case "Users_DeptId": DeptId = Forms.Data(controlId).ToInt(); break;

                case "Users_FirstAndLastNameOrder": FirstAndLastNameOrder = (Names.FirstAndLastNameOrders)Forms.Data(controlId).ToInt(); break;

                case "Users_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Users_LastLoginTime": LastLoginTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "Users_PasswordExpirationTime": PasswordExpirationTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "Users_PasswordChangeTime": PasswordChangeTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "Users_NumberOfLogins": NumberOfLogins = Forms.Data(controlId).ToInt(); break;

                case "Users_NumberOfDenial": NumberOfDenial = Forms.Data(controlId).ToInt(); break;

                case "Users_TenantManager": TenantManager = Forms.Data(controlId).ToBool(); break;

                case "Users_Disabled": Disabled = Forms.Data(controlId).ToBool(); break;

                case "Users_OldPassword": OldPassword = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_ChangedPassword": ChangedPassword = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_ChangedPasswordValidator": ChangedPasswordValidator = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_AfterResetPassword": AfterResetPassword = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_AfterResetPasswordValidator": AfterResetPasswordValidator = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_DemoMailAddress": DemoMailAddress = Forms.Data(controlId).ToString(); break;

                case "Users_SessionGuid": SessionGuid = Forms.Data(controlId).ToString(); break;

                case "Users_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default: break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Пример #24
0
 private static bool Authenticate()
 {
     return(Authentications.Windows() || Authentications.Try(
                Forms.Data("Users_LoginId"), Forms.Data("Users_Password").Sha512Cng()));
 }
        /// <summary>
        /// Fixed:
        /// </summary>
        private static Dictionary <string, ControlData> SelectableMembers()
        {
            var data       = new Dictionary <string, ControlData>();
            var searchText = Forms.Data("SearchMemberText");

            if (!searchText.IsNullOrEmpty())
            {
                var currentMembers = Forms.List("CurrentMembersAll");
                Rds.ExecuteTable(statements: new SqlStatement[]
                {
                    Rds.SelectDepts(
                        column: Rds.DeptsColumn()
                        .DeptId()
                        .DeptCode()
                        .Add("0 as [UserId]")
                        .Add("'' as [UserCode]")
                        .Add("0 as [IsUser]"),
                        where : Rds.DeptsWhere()
                        .TenantId(Sessions.TenantId())
                        .DeptId_In(
                            currentMembers?
                            .Where(o => o.StartsWith("Dept,"))
                            .Select(o => o.Split_2nd().ToInt()),
                            negative: true)
                        .SqlWhereLike(
                            searchText,
                            Rds.Depts_DeptCode_WhereLike(),
                            Rds.Depts_DeptName_WhereLike())),
                    Rds.SelectUsers(
                        unionType: Sqls.UnionTypes.Union,
                        column: Rds.UsersColumn()
                        .Add("0 as [DeptId]")
                        .Add("'' as [DeptCode]")
                        .UserId()
                        .UserCode()
                        .Add("1 as [IsUser]"),
                        join: Rds.UsersJoin()
                        .Add(new SqlJoin(
                                 tableBracket: "[Depts]",
                                 joinType: SqlJoin.JoinTypes.LeftOuter,
                                 joinExpression: "[Users].[DeptId]=[Depts].[DeptId]")),
                        where : Rds.UsersWhere()
                        .TenantId(Sessions.TenantId())
                        .UserId_In(
                            currentMembers?
                            .Where(o => o.StartsWith("User,"))
                            .Select(o => o.Split_2nd().ToInt()),
                            negative: true)
                        .SqlWhereLike(
                            searchText,
                            Rds.Users_LoginId_WhereLike(),
                            Rds.Users_Name_WhereLike(),
                            Rds.Users_UserCode_WhereLike(),
                            Rds.Users_Body_WhereLike(),
                            Rds.Depts_DeptCode_WhereLike(),
                            Rds.Depts_DeptName_WhereLike(),
                            Rds.Depts_Body_WhereLike())
                        .Users_Disabled(0))
                })
                .AsEnumerable()
                .OrderBy(o => o["IsUser"])
                .ThenBy(o => o["DeptCode"])
                .ThenBy(o => o["DeptId"])
                .ThenBy(o => o["UserCode"])
                .ForEach(dataRow =>
                         data.AddMember(dataRow));
            }
            return(data);
        }
Пример #26
0
        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;
        }