/// <summary> /// Returns true if PdfSplitResponse instances are equal /// </summary> /// <param name="input">Instance of PdfSplitResponse to be compared</param> /// <returns>Boolean</returns> public bool Equals(PdfSplitResponse input) { if (input == null) { return(false); } return (( Error == input.Error || (Error != null && Error.Equals(input.Error)) ) && ( RemainingTokens == input.RemainingTokens || RemainingTokens.Equals(input.RemainingTokens) ) && ( FileIds == input.FileIds || FileIds != null && input.FileIds != null && FileIds.SequenceEqual(input.FileIds) ) && ( FileData == input.FileData || FileData != null && input.FileData != null && FileData.SequenceEqual(input.FileData) )); }
internal override HttpContent GenerateRequestBody() { if (FileIds is null || !FileIds.Any()) { throw new ArgumentException("You must provide at least one file to extract"); } return(new StringContent(JsonSerializer.Serialize(this), Encoding.UTF8, "application/json")); }
public override Task <FileIds> GetFiles(Empty request, ServerCallContext context) { var ids = Directory.GetFiles(_storageOptions.StorageFolder) .Select(Path.GetFileName) .ToArray(); var fileIds = new FileIds(); fileIds.Id.AddRange(ids); return(Task.FromResult(fileIds)); }
internal Int32 GetFileId(String file) { if (!FileIds.TryGetValue(file, out Int32 id)) { id = FileIds.Count + 1; FileIds.Add(file, id); FileNames.Add(file); } return(id); }
/// <summary> /// Remove a file id from the id list. /// </summary> /// <param name="id">The id to remove.</param> public void RemoveFileId(int id) { StringBuilder str = new StringBuilder(FileIds); str.Replace($"{id},", string.Empty); FileIds = str.ToString().Trim(); if (FileIds.Equals("")) { FileIds = "N/A"; } }
/// <summary> /// Add a new file id to the id list. /// </summary> /// <param name="id">The id to add.</param> public void AddFileId(int id) { if (FileIds.Equals("N/A")) { FileIds = ""; } if (FileIds.Contains($"{id}")) { return; } StringBuilder str = new StringBuilder(FileIds); str.Append($"{id}, "); FileIds = str.ToString().Trim(); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Error != null) { hashCode = hashCode * 59 + Error.GetHashCode(); } hashCode = hashCode * 59 + RemainingTokens.GetHashCode(); if (FileIds != null) { hashCode = hashCode * 59 + FileIds.GetHashCode(); } if (FileData != null) { hashCode = hashCode * 59 + FileData.GetHashCode(); } return(hashCode); } }
private void BindDefaultValues() { string fromEmail = Security.CurrentUser.Email; if (IncidentId > 0) { fromEmail = EMailRouterOutputMessage.FindEMailRouterPublicEmail(IncidentId); } txtFrom.Text = String.Format(CultureInfo.InvariantCulture, "{1} <{0}>", fromEmail, Security.CurrentUser.DisplayName); lblCCTitle.Text = ""; lblToTitle.Text = LocRM.GetString("tTo") + ":"; if (IncidentId > 0) { NameValueCollection _params = new NameValueCollection(); _params["IssueId"] = IncidentId.ToString(); string[] erList = EMailClient.GetDefaultRecipientList(EMailClient.IssueMode, _params); for (int i = 0; i < erList.Length; i++) { string sName = GetNameByEMail(erList[i]); if (sName != "") { lblCC.Text += String.Format(CultureInfo.InvariantCulture, "{0} <{1}>; ", sName, erList[i]); } else { lblCC.Text += erList[i] + "; "; } } string sValue = EMailMessage.GetOutgoingEmailFormatBodyPreview(IncidentId).Replace("[=Text=]", ""); if (NodeId > 0) { EMailMessageInfo mi = EMailMessageInfo.Load(NodeId); sValue += "<br/>" + "<blockquote style='border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;' dir='ltr'>" + mi.HtmlBody + "</blockquote>"; } fckEditor.Text = sValue; using (IDataReader reader = Incident.GetIncident(IncidentId)) { if (reader.Read()) { txtSubject.Text = string.Format(CultureInfo.InvariantCulture , "RE: [{0}] {1}" , (reader["Identifier"] != DBNull.Value) ? reader["Identifier"].ToString() : TicketUidUtil.Create(IncidentBox.Load((int)reader["IncidentBoxId"]).IdentifierMask, IncidentId) , HttpUtility.HtmlDecode(reader["Title"].ToString()) ); } } } if (FileIds != "") { string sFiles = FileIds.Trim(); if (sFiles.EndsWith(",")) { sFiles = sFiles.Substring(0, sFiles.Length - 1); } string[] masFiles = sFiles.Split(','); if (masFiles.Length > 0) { string _containerName = "FileLibrary"; string _containerKey = "EMailAttach"; CS.BaseIbnContainer bic = CS.BaseIbnContainer.Create(_containerName, _containerKey); CS.FileStorage fs = (CS.FileStorage)bic.LoadControl("FileStorage"); CS.BaseIbnContainer bic2 = CS.BaseIbnContainer.Create(FilesContainerName, FilesContainerKey); CS.FileStorage fs2 = (CS.FileStorage)bic.LoadControl("FileStorage"); CS.DirectoryInfo di = fs.GetDirectory(fs.Root.Id, _guid, true); for (int i = 0; i < masFiles.Length; i++) { fs2.CopyFile(int.Parse(masFiles[i]), di.Id); } Page.ClientScript.RegisterStartupScript(this.GetType(), "_getFiles", "window.setTimeout('updateAttachments()', 500);", true); } } if (ErrorId != "") { string support_email = GlobalResourceManager.Strings["SupportEmail"]; //if (Security.CurrentUser != null && Security.CurrentUser.Culture.ToLower().IndexOf("ru") >= 0) // support_email = "*****@*****.**"; txtTo.Text = support_email + "; "; txtSubject.Text = String.Format("{0} {1} {2} Error Report", IbnConst.CompanyName, IbnConst.ProductFamilyShort, IbnConst.VersionMajorDotMinor); string prefix = Request.Url.Host.Replace(".", "_"); string FilePath = Server.MapPath("../Admin/Log/Error/" + prefix + "_" + ErrorId + ".html"); string sTemp = String.Empty; using (StreamReader sr = File.OpenText(FilePath)) { sTemp += sr.ReadToEnd(); } Match match = Regex.Match(sTemp, @"<body[^>]*>(?<HtmlBody>[\s\S]*?)</body>", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Multiline); if (match.Success) { string body = match.Groups["HtmlBody"].Value; Match matchStyle = Regex.Match(sTemp, @"<style[^>]*>(?<HtmlStyle>[\s\S]*?)</style>", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Multiline); if (matchStyle.Success) { body += matchStyle.Value; } sTemp = body; } fckEditor.Text = sTemp; } if (lblCC.Text != "") { lblCCTitle.Text = LocRM.GetString("tTo") + ":"; lblToTitle.Text = LocRM.GetString("tCc") + ":"; } }
/// <summary> /// Populates the objects for this survey with values from the database. /// <para>Gets the survey's Client, County, Realtor, TitleCompany, and any files associated with it.</para> /// </summary> public void SetObjects() { if (ClientID != 0) { Thread dbThread = new Thread(() => { Client = Database.GetClient(ClientID); }) { IsBackground = true }; dbThread.Start(); } if (CountyID != 0) { Thread dbThread = new Thread(() => { County = Database.GetCounty(CountyID); }) { IsBackground = true }; dbThread.Start(); } if (RealtorID != 0) { Thread dbThread = new Thread(() => { Realtor = Database.GetRealtor(RealtorID); }) { IsBackground = true }; dbThread.Start(); } if (TitleCompanyID != 0) { Thread dbThread = new Thread(() => { TitleCompany = Database.GetTitleCompany(TitleCompanyID); }) { IsBackground = true }; dbThread.Start(); } if (LocationID != 0) { Thread dbThread = new Thread(() => { Location = Database.GetAddress(LocationID); }) { IsBackground = true }; dbThread.Start(); } if (!FileIds.Equals("N/A")) { Thread dbThread = new Thread(() => { int[] ids = ParseIds(FileIds); Files = Database.GetFiles(ids); }) { IsBackground = true }; dbThread.Start(); } if (!NotesString.Equals("N/A")) { ParseNotes(NotesString); } BillingObject.SetObjects(); }