示例#1
0
        //map table欄位 - ForensicContact
        public ForensicContact ContaMapper(ForensicContact conta, IRow row)
        {
            DataFormatter Formatter = new DataFormatter(CultureInfo.CurrentCulture);
            string        firstCell = Formatter.FormatCellValue(row.GetCell(0));

            //判斷是否通聯記錄內容
            if (int.TryParse(firstCell, out int result) && firstCell != "")
            {
                conta.FSheetNum  = 1;
                conta.FSheetName = row.Sheet.SheetName;
                conta.FNum       = result;
                conta.FName      = Formatter.FormatCellValue(row.GetCell(1));
                conta.FGroup     = Formatter.FormatCellValue(row.GetCell(2));

                conta.FModifiedTime = ParseHelper.ParseDateTime(Formatter.FormatCellValue(row.GetCell(3)));

                conta.FClause   = Formatter.FormatCellValue(row.GetCell(4));
                conta.FNote     = Formatter.FormatCellValue(row.GetCell(5));
                conta.FSource   = Formatter.FormatCellValue(row.GetCell(6));
                conta.isDeleted = Formatter.FormatCellValue(row.GetCell(7)) == "是" ? true : false;

                return(conta);
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        ///存到資料庫- ForensicContact
        public void ContaCreate(ISheet sheet, Attachment attach)
        {
            IRow row = null;

            if (sheet != null)
            {
                int rowCount = sheet.LastRowNum;
                if (rowCount > 0)
                {
                    IRow firstRow = sheet.GetRow(0);        //NPOI row

                    for (int i = 0; i <= rowCount; i++)
                    {
                        row = sheet.GetRow(i);
                        if (row == null)
                        {
                            continue;
                        }
                        ForensicContact conta = new ForensicContact();
                        conta = ContaMapper(conta, row);
                        if (conta != null)
                        {
                            conta.GetType().GetProperty("AttachmentId").SetValue(conta, attach.AttachmentId);
                            contService.Create(conta);
                        }
                    }
                }
            }
        }
示例#3
0
 public ActionResult EditConta(ForensicContact con)
 {
     //id= ForensicContaId
     foreSrv.contService.Update(con);
     return(RedirectToAction("IndexContact", new { id = con.AttachmentId }));
 }