Пример #1
0
 /// <summary>
 /// 增加附件
 /// </summary>
 public FineOffice.Modules.HD_Attachment Add(FineOffice.Modules.HD_Attachment model)
 {
     dal.Initialization();
     FineOffice.Entity.HD_Attachment entity = new Entity.HD_Attachment
     {
         ID             = model.ID,
         Remark         = model.Remark,
         FolderID       = model.FolderID,
         AttachmentData = model.AttachmentData,
         FileName       = model.FileName,
         PersonnelID    = model.PersonnelID,
         Size           = model.Size,
         IsPublic       = model.IsPublic,
         Owner          = model.Owner,
         CreateTime     = model.CreateTime,
         XType          = model.XType,
         XTypeName      = model.XTypeName,
         SendID         = model.SendID,
         SendTime       = model.SendTime,
     };
     dal.Add(entity);
     model.ID = entity.ID;
     dal.Dispose();
     return(model);
 }
Пример #2
0
 public void TransferToComAttachment(List <int> ids)
 {
     using (DataContext cxt = ContextFactory.CreateContext())
     {
         try
         {
             Table <FineOffice.Entity.OA_Attachment> attachment = cxt.GetTable <FineOffice.Entity.OA_Attachment>();
             Table <FineOffice.Entity.HD_Attachment> comAtt     = cxt.GetTable <FineOffice.Entity.HD_Attachment>();
             List <FineOffice.Entity.HD_Attachment>  list       = new List <Entity.HD_Attachment>();
             foreach (int id in ids)
             {
                 FineOffice.Entity.OA_Attachment entity = attachment.Where(d => d.ID == id).FirstOrDefault();
                 FineOffice.Entity.HD_Attachment att    = new Entity.HD_Attachment
                 {
                     AttachmentData = entity.AttachmentData,
                     CreateTime     = entity.CreateTime,
                     FileName       = entity.FileName,
                     PersonnelID    = entity.HR_Personnel.ID,
                     Remark         = entity.Remark,
                     XType          = entity.XType,
                     XTypeName      = entity.XTypeName,
                     Size           = entity.Size
                 };
                 list.Add(att);
             }
             comAtt.InsertAllOnSubmit(list);
             cxt.SubmitChanges();
         }
         catch (Exception ex)
         {
             throw new Exception(ex.Message);
         }
     }
 }
Пример #3
0
 public void Delete(Modules.HD_Attachment model)
 {
     dal.Initialization();
     FineOffice.Entity.HD_Attachment entity = new Entity.HD_Attachment
     {
         ID = model.ID,
     };
     dal.Delete(entity);
     dal.Dispose();
 }