public void SetByForm(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 = 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; } }); }
public void SetByForm() { Forms.Keys().ForEach(controlId => { switch (controlId) { case "Binaries_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 "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: 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 "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: 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) { 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; } }); }
/// <summary> /// Fixed: /// </summary> public static string UploadImage( Context context, System.Web.HttpPostedFileBase[] files, long id) { var controlId = Forms.ControlId(); var ss = new ItemModel( context: context, referenceId: id).GetSite( context: context, initSiteSettings: true) .SiteSettings; var invalid = BinaryValidators.OnUploadingImage( context: context, files: files); switch (invalid) { case Error.Types.OverTenantStorageSize: return(Messages.ResponseOverTenantStorageSize( Contract.TenantStorageSize(context: context).ToString()).ToJson()); case Error.Types.None: break; default: return(invalid.MessageJson()); } var guid = Strings.NewGuid(); var file = files[0]; var size = file.ContentLength; var bin = file.Byte(); Rds.ExecuteNonQuery( context: context, statements: Rds.InsertBinaries( param: Rds.BinariesParam() .TenantId(context.TenantId) .ReferenceId(id) .Guid(guid) .BinaryType("Images") .Title(file.FileName) .Bin(bin, _using: !Parameters.BinaryStorage.IsLocal()) .FileName(file.FileName) .Extension(file.Extension()) .Size(size) .ContentType(file.ContentType))); if (Parameters.BinaryStorage.IsLocal()) { bin.Write(System.IO.Path.Combine(Directories.BinaryStorage(), "Images", guid)); } var hb = new HtmlBuilder(); return(new ResponseCollection() .InsertText("#" + Forms.ControlId(), $"![image]({Locations.ShowFile(guid)})") .ToJson()); }
/// <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()); }
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; } }); }
private static bool Reduced(long?siteId) { var key = "ReduceViewFilters_" + (siteId != null ? Pages.Key() : siteId.ToString()); if (Forms.ControlId() == "ReduceViewFilters") { HttpContext.Current.Session[key] = true; } else if (Forms.ControlId() == "ExpandViewFilters") { HttpContext.Current.Session.Remove(key); } return(HttpContext.Current.Session[key].ToBool()); }
private static bool Reduced(long siteId) { var key = "ReduceAggregations_" + (siteId == 0 ? Pages.Key() : siteId.ToString()); if (Forms.ControlId() == "ReduceAggregations") { HttpContext.Current.Session[key] = true; } else if (Forms.ControlId() == "ExpandAggregations") { HttpContext.Current.Session.Remove(key); } return(HttpContext.Current.Session[key].ToBool()); }
private static bool Reduced(long siteId) { var key = "ReduceAggregations_" + (siteId == 0 ? Pages.Key() : siteId.ToString()); if (Forms.ControlId() == "ReduceAggregations") { Sessions.Set(key, true); } else if (Forms.ControlId() == "ExpandAggregations") { AspNetCoreHttpContext.Current.Session.Remove(key); } return(Sessions.Get <bool>(key)); }
private static ResponseCollection ViewFilters( this ResponseCollection res, SiteSettings ss, View view) { var controlId = Forms.ControlId(); switch (Forms.ControlId()) { case "ViewSelector": case "ReduceViewFilters": case "ExpandViewFilters": return(res.ReplaceAll("#ViewFilters", new HtmlBuilder().ViewFilters(ss, view))); default: return(res); } }
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; } }); }
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; } }); }
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; } }); }
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; } }); }
public void SetByForm(SiteSettings ss) { Forms.Keys().ForEach(controlId => { switch (controlId) { case "Wikis_Title": Title = new Title(WikiId, Forms.Data(controlId)); break; case "Wikis_Body": Body = Forms.Data(controlId).ToString(); break; case "Wikis_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; } }); SetByFormula(ss); SetChoiceHash(ss); if (Routes.Action() == "deletecomment") { DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt(); Comments.RemoveAll(o => o.CommentId == DeleteCommentId); } Forms.FileKeys().ForEach(controlId => { switch (controlId) { default: break; } }); }
/// <summary> /// Fixed: /// </summary> public string Set(SiteSettings ss, long id) { var invalid = ExportSettingValidator.OnExporting(ss); switch (invalid) { case Error.Types.None: break; default: return(invalid.MessageJson()); } var res = new ExportSettingsResponseCollection(this); ExportColumns = Session_ExportColumns(); ExportColumns.SetExport( res, Forms.ControlId(), Forms.List("ExportSettings_Columns"), GetSiteSettings()); ExportSettingUtilities.SetSessions(this); return(res.ToJson()); }
/// <summary> /// Fixed: /// </summary> public static string UploadImage(System.Web.HttpPostedFileBase[] files, long id) { var controlId = Forms.ControlId(); var ss = new ItemModel(id).GetSite(initSiteSettings: true).SiteSettings; var invalid = BinaryValidators.OnUploadingImage(files); switch (invalid) { case Error.Types.OverTenantStorageSize: return(Messages.ResponseOverTenantStorageSize( Contract.TenantStorageSize().ToString()).ToJson()); case Error.Types.None: break; default: return(invalid.MessageJson()); } var guid = Strings.NewGuid(); var file = files[0]; Rds.ExecuteNonQuery(statements: Rds.InsertBinaries( param: Rds.BinariesParam() .TenantId(Sessions.TenantId()) .ReferenceId(id) .Guid(guid) .BinaryType("Image") .Title(file.FileName) .Bin(file.Byte()) .FileName(file.FileName) .Extension(file.Extension()) .Size(file.ContentLength) .ContentType(file.ContentType))); var hb = new HtmlBuilder(); return(new ResponseCollection() .InsertText("#" + Forms.ControlId(), $"![image]({Locations.ShowFile(guid)})") .ToJson()); }
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 = 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; } }); }
public GanttRange(SiteSettings ss, View view) { Set(ss, view); if (view.GanttPeriod == null) { if (view.GanttStartDate == null) { view.GanttStartDate = Min; } view.GanttPeriod = Period; } else if (Forms.ControlId().StartsWith("ViewFilters_")) { view.GanttPeriod = Period; } else { if (view.GanttPeriod.ToInt() > Period) { view.GanttPeriod = Period; } } }
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; } }); }