예제 #1
0
        public bool IsExistReimageSummaryAttachment()
        {
            var reimageSummaryId = new Guid("5647BDBB-5B5F-47CD-9AD2-3E35A16DD303");

            return(Attachment.Any(e => e.RefTableID == Id.ToString() &&
                                  e.RefTableName == TableName &&
                                  e.RequirementId == reimageSummaryId));
        }
예제 #2
0
 public void GenerateCover()
 {
     if (!Attachment.Any(att => att.RefTableID == this.Id.ToString() && att.RequirementId == new Guid("9D1E247C-AAE0-44F6-869E-F50B3E633C1C")))
     {
         var info             = RenewalInfo.Get(this.ProjectId);
         var store            = StoreBasicInfo.GetStorInfo(info.USCode);
         var contract         = StoreContractInfo.Get(info.USCode);
         var context          = HttpContext.Current;
         var templateFileName = context.Server.MapPath("~/Template/RenewalCover_Template_v20130922.xlsx");
         var fileName         = context.Server.MapPath(string.Format("~/UploadFiles/{0}.xlsx", Guid.NewGuid()));
         File.Copy(templateFileName, fileName);
         var fileInfo = new FileInfo(fileName);
         ExcelDataInputDirector excelDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.RenewalCover);
         ExcelInputDTO          excelInput    = new ExcelInputDTO();
         excelInput.Region              = store.RegionENUS;
         excelInput.Province            = store.ProvinceZHCN;
         excelInput.City                = store.CityENUS;
         excelInput.Market              = store.MarketENUS;
         excelInput.StoreName           = store.NameZHCN;
         excelInput.USCode              = store.StoreCode;
         excelInput.OpenDate            = store.OpenDate;
         excelInput.LeaseExpirationDate = contract.EndDate.Value;
         excelInput.Priority            = info.Priority;
         excelDirector.Input(excelInput);
         var att = new Attachment();
         att.ID              = Guid.NewGuid();
         att.RefTableID      = this.Id.ToString();
         att.RefTableName    = this.TableName;
         att.RelativePath    = "/";
         att.TypeCode        = "Cover";
         att.RequirementId   = Guid.Parse("9D1E247C-AAE0-44F6-869E-F50B3E633C1C");
         att.Name            = "Cover";
         att.Extension       = fileInfo.Extension;
         att.InternalName    = fileInfo.Name;
         att.ContentType     = "application/vnd.ms-excel";
         att.Length          = (int)fileInfo.Length;
         att.CreatorID       = ClientCookie.UserCode;
         att.CreatorNameENUS = ClientCookie.UserNameENUS;
         att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
         att.CreateTime      = DateTime.Now;
         att.Add();
     }
 }