public CallIncoming(string phoneNumber, string Link, string date, string comment, string Manager, ProcessedCall call = new ProcessedCall(), string DealState = "", DateTime DateDeal = new DateTime()) { if (Link != "") { this.Link = new XLHyperlink(new Uri(Link)); } else { this.Link = null; } this.phoneNumber = phoneNumber; this.date = date; this.comment = comment; this.Manager = Manager; this.call = call; this.DealState = DealState; this.NoticeCRM = ""; this.DateDeal = ""; if (DealState.ToUpper() != "В РАБОТЕ" && DealState != "") { this.DealState = "Закрыт"; this.NoticeCRM = DealState; this.DateDeal = DateDeal.ToString("dd.MM.yyyy"); } if (DealState.ToUpper() == "В РАБОТЕ") { this.DateDeal = DateDeal.ToString("dd.MM.yyyy"); if (DateDeal.Year < 2000) { this.DateDeal = ""; } } }
private bool Equals(XLHyperlink expectedHyperlink, XLHyperlink actualHyperlink) { if (expectedHyperlink == actualHyperlink) { return(true); } return(expectedHyperlink.IsExternal == actualHyperlink.IsExternal && expectedHyperlink.ExternalAddress == actualHyperlink.ExternalAddress && expectedHyperlink.InternalAddress == actualHyperlink.InternalAddress); }
public IEnumerable <T> GetCellValues <T>(int startRowIndex) where T : new() { Guard.ArgumentIsPositive(startRowIndex, "startRowIndex"); ExcelKeyColumnAttribute keyColumnIndexAttr = typeof(T).GetCustomAttributes(typeof(ExcelKeyColumnAttribute), false).Cast <ExcelKeyColumnAttribute>().FirstOrDefault(); // TODO:ExcelKeyColumnIndexAttributeない時例外をスロー PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public); int lastRowIndex = this.worksheet.LastRowUsed().RowNumber(); for (int i = startRowIndex; i <= lastRowIndex; i++) { IXLRow row = this.worksheet.Row(i); if (row.Cell(keyColumnIndexAttr.ColumnIndex).IsEmpty()) { break; } T value = new T(); foreach (PropertyInfo property in properties) { ExcelCellValueAttribute attr = property.GetCustomAttributes(typeof(ExcelCellValueAttribute), false).Cast <ExcelCellValueAttribute>().FirstOrDefault(); if (attr == null) { attr = property.GetAttributeFromMetaData <ExcelCellValueAttribute>(); } if (attr != null) { string s = row.Cell(attr.ColumnIndex).GetValue <string>(); property.SetValue(value, s, null); continue; } ExcelCellInternallHyperlinkAttribute linkAttr = null; linkAttr = property.GetCustomAttributes(typeof(ExcelCellInternallHyperlinkAttribute), false).Cast <ExcelCellInternallHyperlinkAttribute>().FirstOrDefault(); if (linkAttr == null) { linkAttr = property.GetAttributeFromMetaData <ExcelCellInternallHyperlinkAttribute>(); } if (linkAttr == null) { continue; } IXLCell linkCell = row.Cell(linkAttr.ColumnIndex); if (linkCell.HasHyperlink == false) { continue; } XLHyperlink link = linkCell.Hyperlink; if (link.IsExternal) { continue; } property.SetValue(value, new ExcelInternalHyperlink(link.Cell.GetValue <string>(), link.InternalAddress), null); } yield return(value); } }