コード例 #1
0
        public IHttpActionResult GetCreateFlowInfo(string projectId, string flowCode)
        {
            Object entity = null;

            if (flowCode.ToLower() == "rebuild")
            {
                entity = new RebuildInfo().GetRebuildInfo(projectId);
            }
            else if (flowCode.ToLower() == "reimage")
            {
                entity = ReimageInfo.GetReimageInfo(projectId);
            }
            else if (flowCode.ToLower() == "renewal")
            {
                entity = RenewalInfo.Get(projectId);
            }
            else if (flowCode.ToLower() == "tempclosure")
            {
                entity = TempClosureInfo.Get(projectId);
            }
            else if (flowCode.ToLower() == "closure")
            {
                entity = ClosureInfo.GetByProjectId(projectId);
            }
            else if (flowCode.ToLower() == "majorlease")
            {
                entity = new MajorLeaseInfo().GetMajorLeaseInfo(projectId);
            }
            return(Ok(entity));
        }
コード例 #2
0
        private void GenerateCover(string projectId, string refTableName)
        {
            string coverPath      = string.Empty;
            string coverName      = "Cover";
            string coverTempPath  = SiteFilePath.UploadFiles_DIRECTORY + "\\" + Guid.NewGuid() + ".xlsx";
            string coverExtention = Path.GetExtension(coverTempPath);

            switch (refTableName)
            {
            case "MajorLeaseChangePackage":
                coverPath = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.MajorLeaseChangeCove_Template;
                var majorLeaseChangePackage = MajorLeaseChangePackage.GetMajorPackageInfo(projectId);
                majorLeaseChangePackage.GenerateCoverEexcel(coverPath, coverTempPath);
                break;

            case "ReimagePackage":
                var rmgPackage = ReimagePackage.Get(projectId);
                if (rmgPackage == null)
                {
                    return;
                }
                if (!Attachment.Any(i => i.TypeCode == "Cover" && i.RefTableName == ReimagePackage.TableName && i.RefTableID.ToString() == rmgPackage.Id.ToString()))
                {
                    var reimageInfoEntity = ReimageInfo.GetReimageInfo(projectId);
                    //生成cover文件
                    coverPath = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Store_Reimage_Cover_Template;
                    var store = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == reimageInfoEntity.USCode);

                    File.Copy(coverPath, coverTempPath);
                    var excelOutputDirector = new ExcelDataInputDirector(new FileInfo(coverTempPath), ExcelDataInputType.ReimageCover);
                    var inputInfo           = new ExcelInputDTO
                    {
                        Region    = store.Region,
                        Province  = store.ProvinceENUS,
                        City      = store.CityENUS,
                        StoreName = store.NameENUS,
                        USCode    = reimageInfoEntity.USCode,
                        OpenDate  = store.OpenDate
                    };
                    excelOutputDirector.Input(inputInfo);

                    var coverItem = new Attachment();
                    coverItem.Name         = coverName + coverExtention;
                    coverItem.InternalName = Path.GetFileName(coverTempPath);
                    coverItem.RefTableName = ReimagePackage.TableName;
                    coverItem.RefTableID   = rmgPackage.Id.ToString();
                    coverItem.RelativePath = "//";
                    coverItem.Extension    = coverExtention;
                    coverItem.CreateTime   = DateTime.Now;

                    coverItem.TypeCode        = coverName;
                    coverItem.CreatorID       = ClientCookie.UserCode;
                    coverItem.RequirementId   = AttachmentRequirement.FirstOrDefault(e => e.FlowCode == FlowCode.Reimage_Package && e.NameENUS == "Cover").Id;
                    coverItem.CreatorNameENUS = ClientCookie.UserNameENUS;
                    coverItem.CreatorNameZHCN = ClientCookie.UserNameZHCN;

                    using (FileStream stream = new FileStream(coverTempPath, FileMode.Open))
                    {
                        coverItem.Length = (int)stream.Length;
                    }
                    Attachment.SaveSigleFile(coverItem);
                }
                break;

            case "TempClosurePackage":
                var tempClosurePackage = TempClosurePackage.Get(projectId);
                if (tempClosurePackage == null)
                {
                    return;
                }
                if (!Attachment.Any(i => i.TypeCode == "Cover" && i.RefTableName == tempClosurePackage.TableName && i.RefTableID.ToString() == tempClosurePackage.Id.ToString()))
                {
                    var tempClosureInfoEntity = TempClosureInfo.Get(projectId);
                    //生成cover文件
                    coverPath = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Store_TempClosure_Cover_Template;
                    var store = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == tempClosureInfoEntity.USCode);

                    File.Copy(coverPath, coverTempPath);
                    var excelOutputDirector = new ExcelDataInputDirector(new FileInfo(coverTempPath), ExcelDataInputType.TempClosureCover);
                    var inputInfo           = new ExcelInputDTO
                    {
                        StoreNameEN     = store.NameENUS,
                        USCode          = tempClosureInfoEntity.USCode,
                        City            = store.CityENUS,
                        Market          = store.MarketENUS,
                        ActualCloseDate = tempClosureInfoEntity.ActualTempClosureDate.ToString("yyyy-MM-dd")
                    };
                    excelOutputDirector.Input(inputInfo);

                    var coverItem = new Attachment();
                    coverItem.Name         = coverName + coverExtention;
                    coverItem.InternalName = Path.GetFileName(coverTempPath);
                    coverItem.RefTableName = tempClosurePackage.TableName;
                    coverItem.RefTableID   = tempClosurePackage.Id.ToString();
                    coverItem.RelativePath = "//";
                    coverItem.Extension    = coverExtention;
                    coverItem.CreateTime   = DateTime.Now;

                    coverItem.TypeCode  = coverName;
                    coverItem.CreatorID = ClientCookie.UserCode;
                    //coverItem.RequirementId = AttachmentRequirement.FirstOrDefault(e => e.FlowCode == FlowCode.TempClosure_ClosurePackage && e.NameENUS == "Cover").Id;
                    coverItem.CreatorNameENUS = ClientCookie.UserNameENUS;
                    coverItem.CreatorNameZHCN = ClientCookie.UserNameZHCN;

                    using (FileStream stream = new FileStream(coverTempPath, FileMode.Open))
                    {
                        coverItem.Length = (int)stream.Length;
                    }
                    Attachment.SaveSigleFile(coverItem);
                }
                break;

            case "ClosurePackage":
                var closurePackage = ClosurePackage.Get(projectId);
                if (closurePackage == null)
                {
                    return;
                }
                if (!Attachment.Any(i => i.TypeCode == "Cover" && i.RefTableName == ClosurePackage.TableName && i.RefTableID.ToString() == closurePackage.Id.ToString()))
                {
                    var closureInfoEntity = ClosureInfo.GetByProjectId(projectId);
                    //生成cover文件
                    coverPath = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Store_Closure_Cover_Template;
                    var store = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == closureInfoEntity.USCode);

                    File.Copy(coverPath, coverTempPath);
                    var excelOutputDirector = new ExcelDataInputDirector(new FileInfo(coverTempPath), ExcelDataInputType.ClosureCover);
                    var inputInfo           = new ExcelInputDTO
                    {
                        StoreNameEN     = store.NameENUS,
                        USCode          = closureInfoEntity.USCode,
                        City            = store.CityENUS,
                        Market          = store.MarketENUS,
                        ActualCloseDate = closureInfoEntity.ActualCloseDate.Value.ToString("yyyy-MM-dd")
                    };
                    excelOutputDirector.Input(inputInfo);

                    var coverItem = new Attachment();
                    coverItem.Name         = coverName + coverExtention;
                    coverItem.InternalName = Path.GetFileName(coverTempPath);
                    coverItem.RefTableName = ClosurePackage.TableName;
                    coverItem.RefTableID   = closurePackage.Id.ToString();
                    coverItem.RelativePath = "//";
                    coverItem.Extension    = coverExtention;
                    coverItem.CreateTime   = DateTime.Now;

                    coverItem.TypeCode  = coverName;
                    coverItem.CreatorID = ClientCookie.UserCode;
                    //coverItem.RequirementId = AttachmentRequirement.FirstOrDefault(e => e.FlowCode == FlowCode.TempClosure_ClosurePackage && e.NameENUS == "Cover").Id;
                    coverItem.CreatorNameENUS = ClientCookie.UserNameENUS;
                    coverItem.CreatorNameZHCN = ClientCookie.UserNameZHCN;

                    using (FileStream stream = new FileStream(coverTempPath, FileMode.Open))
                    {
                        coverItem.Length = (int)stream.Length;
                    }
                    Attachment.SaveSigleFile(coverItem);
                }
                break;
            }
        }
コード例 #3
0
ファイル: DLController.cs プロジェクト: XiaoYaTech/Demo
        public IHttpActionResult UploadAttachment(string flowCode, string typeCode, string usCode, Guid Id)
        {
            var refTableId   = string.Empty;
            var refTableName = string.Empty;
            var projectInfo  = ProjectInfo.Get(Id);
            var projectId    = string.Empty;

            if (projectInfo == null)
            {
                projectId = ProjectInfo.CreateDLProject(Id, flowCode, usCode, NodeCode.Start, ClientCookie.UserCode, false);
            }
            else
            {
                projectId = projectInfo.ProjectId;
            }
            using (TransactionScope tranScope = new TransactionScope())
            {
                switch (flowCode)
                {
                case FlowCode.Closure:
                    refTableName = "ClosureInfo";
                    var closureInfo = ClosureInfo.FirstOrDefault(i => i.ProjectId == projectId);
                    if (closureInfo != null)
                    {
                        refTableId = closureInfo.Id.ToString();
                    }
                    else
                    {
                        closureInfo                    = new ClosureInfo();
                        closureInfo.Id                 = Guid.NewGuid();
                        closureInfo.ProjectId          = projectId;
                        closureInfo.USCode             = usCode;
                        closureInfo.CreateDate         = DateTime.Now;
                        closureInfo.CreateUserAccount  = ClientCookie.UserCode;
                        closureInfo.CreateUserNameENUS = ClientCookie.UserNameENUS;
                        closureInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                        closureInfo.Add();
                        refTableId = closureInfo.Id.ToString();
                    }
                    break;

                case FlowCode.Rebuild:
                    refTableName = "RebuildInfo";
                    var rebuildInfo = RebuildInfo.FirstOrDefault(i => i.ProjectId == projectId);
                    if (rebuildInfo != null)
                    {
                        refTableId = rebuildInfo.Id.ToString();
                    }
                    else
                    {
                        rebuildInfo                    = new RebuildInfo();
                        rebuildInfo.Id                 = Guid.NewGuid();
                        rebuildInfo.ProjectId          = projectId;
                        rebuildInfo.USCode             = usCode;
                        rebuildInfo.CreateTime         = DateTime.Now;
                        rebuildInfo.CreateUserAccount  = ClientCookie.UserCode;
                        rebuildInfo.CreateUserNameENUS = ClientCookie.UserNameENUS;
                        rebuildInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                        rebuildInfo.Add();
                        refTableId = rebuildInfo.Id.ToString();
                    }
                    break;

                case FlowCode.MajorLease:
                    refTableName = "MajorLeaseInfo";
                    var majorLeaseInfo = MajorLeaseInfo.FirstOrDefault(i => i.ProjectId == projectId);
                    if (majorLeaseInfo != null)
                    {
                        refTableId = majorLeaseInfo.Id.ToString();
                    }
                    else
                    {
                        majorLeaseInfo                    = new MajorLeaseInfo();
                        majorLeaseInfo.Id                 = Guid.NewGuid();
                        majorLeaseInfo.ProjectId          = projectId;
                        majorLeaseInfo.USCode             = usCode;
                        majorLeaseInfo.CreateTime         = DateTime.Now;
                        majorLeaseInfo.CreateUserAccount  = ClientCookie.UserCode;
                        majorLeaseInfo.CreateUserNameENUS = ClientCookie.UserNameENUS;
                        majorLeaseInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                        majorLeaseInfo.Add();
                        refTableId = majorLeaseInfo.Id.ToString();
                    }
                    break;

                case FlowCode.Renewal:
                    refTableName = "RenewalInfo";
                    var renewalInfo = RenewalInfo.Get(projectId);
                    if (renewalInfo != null)
                    {
                        refTableId = renewalInfo.Id.ToString();
                    }
                    else
                    {
                        renewalInfo                   = new RenewalInfo();
                        renewalInfo.Id                = Guid.NewGuid();
                        renewalInfo.ProjectId         = projectId;
                        renewalInfo.USCode            = usCode;
                        renewalInfo.CreateTime        = DateTime.Now;
                        renewalInfo.CreateUserAccount = ClientCookie.UserCode;
                        renewalInfo.Add();
                        refTableId = renewalInfo.Id.ToString();
                    }
                    break;

                case FlowCode.Reimage:
                    refTableName = "ReimageInfo";
                    var reimageInfo = ReimageInfo.GetReimageInfo(projectId);
                    if (reimageInfo != null)
                    {
                        refTableId = reimageInfo.Id.ToString();
                    }
                    else
                    {
                        reimageInfo                    = new ReimageInfo();
                        reimageInfo.Id                 = Guid.NewGuid();
                        reimageInfo.ProjectId          = projectId;
                        reimageInfo.USCode             = usCode;
                        reimageInfo.CreateDate         = DateTime.Now;
                        reimageInfo.CreateUserAccount  = ClientCookie.UserCode;
                        reimageInfo.CreateUserNameENUS = ClientCookie.UserNameENUS;
                        reimageInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                        reimageInfo.Add();
                        refTableId = reimageInfo.Id.ToString();
                    }
                    break;
                }

                if (!string.IsNullOrEmpty(refTableId))
                {
                    var    files         = HttpContext.Current.Request.Files;
                    var    file          = files[0];
                    string fileName      = Path.GetFileName(file.FileName);
                    string fileExtension = Path.GetExtension(file.FileName);
                    var    current       = System.Web.HttpContext.Current;
                    string internalName  = Guid.NewGuid() + fileExtension;
                    string absolutePath  = current.Server.MapPath("~/") + "UploadFiles/" + internalName;
                    file.SaveAs(absolutePath);

                    Attachment att = Attachment.FirstOrDefault(i => i.RefTableID == refTableId && i.RefTableName == refTableName && i.TypeCode == typeCode);
                    if (att != null)
                    {
                        att.InternalName    = internalName;
                        att.RefTableName    = refTableName;
                        att.RefTableID      = refTableId;
                        att.RelativePath    = "//";
                        att.Name            = fileName;
                        att.Extension       = fileExtension;
                        att.Length          = file.ContentLength;
                        att.CreateTime      = DateTime.Now;
                        att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                        att.CreatorNameENUS = ClientCookie.UserNameENUS;
                        att.CreatorID       = ClientCookie.UserCode;
                        Attachment.Update(att);
                    }
                    else
                    {
                        att = new Attachment();
                        att.InternalName    = internalName;
                        att.RefTableName    = refTableName;
                        att.RefTableID      = refTableId;
                        att.RelativePath    = "//";
                        att.Name            = fileName;
                        att.Extension       = fileExtension;
                        att.Length          = file.ContentLength;
                        att.CreateTime      = DateTime.Now;
                        att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                        att.CreatorNameENUS = ClientCookie.UserNameENUS;
                        att.CreatorID       = ClientCookie.UserCode;
                        att.ID       = Guid.NewGuid();
                        att.TypeCode = typeCode;
                        Attachment.Add(att);
                    }
                }
                tranScope.Complete();
                return(Ok());
            }
        }
コード例 #4
0
        public IHttpActionResult DownLoadTemplate(string templateType, string projectId, string consInfoID = "", string NormType = "", string flowCode = "")
        {
            var current = HttpContext.Current;
            ExcelDataInputType outputType;

            if (!Enum.TryParse(templateType, out outputType))
            {
                throw new Exception("Cannot find the specific template type!");
            }

            if (string.IsNullOrEmpty(projectId))
            {
                throw new Exception("Porject Id is Empty !");
            }
            var siteFilePath = default(string);

            switch (outputType)
            {
            case ExcelDataInputType.WriteOffAmount:
                siteFilePath = SiteFilePath.FAWrite_offTool_Template_X;
                break;

            case ExcelDataInputType.ReinvestmentCost:
                siteFilePath = SiteFilePath.FATool_Update_Template;
                break;

            case ExcelDataInputType.ClosureWOCheckList:
                siteFilePath = SiteFilePath.Closure_FAWrite_offTool_Template;
                break;
            }
            var path = string.Format(@"{0}\{1}", SiteFilePath.Template_DIRECTORY, siteFilePath);

            var tempFilePath = current.Server.MapPath("~/") + "Temp\\" + Guid.NewGuid() + ".xlsx";

            bool isNotUploadExcel = false;

            if (!string.IsNullOrEmpty(consInfoID))
            {
                string refTableName = "MajorLeaseConsInfo";
                if (projectId.ToLower().IndexOf("rebuild") != -1)
                {
                    refTableName = "RebuildConsInfo";
                }
                if (projectId.ToLower().IndexOf("reimage") != -1)
                {
                    refTableName = "ReimageConsInfo";
                }

                var strFileName = GetAttatchFile(refTableName, templateType, consInfoID);//download consifno upload file
                if (string.IsNullOrEmpty(strFileName))
                {
                    isNotUploadExcel = true;
                    tempFilePath     = current.Server.MapPath("~/") + "UploadFiles\\" + Guid.NewGuid() + ".xlsx";
                }
                else
                {
                    tempFilePath = current.Server.MapPath("~/") + "UploadFiles\\" + strFileName;
                }
            }

            if (isNotUploadExcel)
            {
                consInfoID = null;// if not upload file in consinfo flow,then we get empty template
            }
            var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == projectId);

            if (projectInfo == null)
            {
                throw new Exception("Cannot find the project info!");
            }
            if (string.IsNullOrEmpty(consInfoID))
            {
                File.Copy(path, tempFilePath);

                var excelOutputDirector = new ExcelDataInputDirector(new FileInfo(tempFilePath), outputType);
                var store = StoreBasicInfo.Search(e => e.StoreCode == projectInfo.USCode).FirstOrDefault();
                if (store == null)
                {
                    throw new Exception("Cannot find Store info!");
                }

                var inputInfo = new ExcelInputDTO
                {
                    Region        = store.RegionENUS,
                    Market        = store.MarketENUS,
                    City          = store.CityENUS,
                    StoreNameCN   = store.NameZHCN,
                    StoreNameEN   = store.NameENUS,
                    StoreName     = store.NameZHCN,
                    USCode        = store.StoreCode,
                    StoreType     = store.StoreType,
                    StoreTypeName = store.StoreTypeName,
                    OpenDate      = store.OpenDate,
                    ClosureDate   = store.CloseDate.HasValue ? store.CloseDate.Value : default(DateTime)
                };

                switch (outputType)
                {
                case ExcelDataInputType.ReinvestmentCost:
                    Guid consInfoId = Guid.Empty;
                    if (projectId.ToLower().IndexOf("rebuild") != -1)
                    {
                        var rbdInfo = new RebuildConsInfo();
                        consInfoId = rbdInfo.GetConsInfo(projectId).Id;
                    }
                    else if (projectId.ToLower().IndexOf("majorlease") != -1)
                    {
                        var mjInfo = new MajorLeaseConsInfo();
                        consInfoId = mjInfo.GetConsInfo(projectId).Id;
                    }
                    else if (projectId.ToLower().IndexOf("reimage") != -1)
                    {
                        consInfoId = ReimageConsInfo.GetConsInfo(projectId).Id;
                    }
                    var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == consInfoId);
                    if (reinvestmentBasicInfo != null)
                    {
                        inputInfo.NewDesignType      = reinvestmentBasicInfo.NewDesignType;
                        inputInfo.NormType           = MappingNormType(NormType);
                        inputInfo.GBDate             = reinvestmentBasicInfo.GBDate;
                        inputInfo.ConsCompletionDate = reinvestmentBasicInfo.ConsCompletionDate;
                        inputInfo.EstimatedSeatNO    = reinvestmentBasicInfo.EstimatedSeatNo;
                        inputInfo.NewDTSiteArea      = reinvestmentBasicInfo.NewDTSiteArea;
                        inputInfo.NewOperationArea   = reinvestmentBasicInfo.NewOperationSize;
                        inputInfo.NewDiningArea      = reinvestmentBasicInfo.NewDiningArea;
                        inputInfo.WallPanelArea      = reinvestmentBasicInfo.WallPanelArea;
                        inputInfo.WallGraphicArea    = reinvestmentBasicInfo.WallGraphicArea;
                        inputInfo.FacadeACMArea      = reinvestmentBasicInfo.FacadeACMArea;
                        inputInfo.NewRemoteKiosk     = reinvestmentBasicInfo.NewRemoteKiosk;
                        inputInfo.NewAttachedKiosk   = reinvestmentBasicInfo.NewAttachedKiosk;
                        inputInfo.NewMcCafe          = reinvestmentBasicInfo.NewMcCafe;
                        inputInfo.NewMDS             = reinvestmentBasicInfo.NewMDS;
                    }

                    break;

                case ExcelDataInputType.WriteOffAmount:
                    string pmName = string.Empty;
                    if (projectId.ToLower().IndexOf("rebuild") != -1)
                    {
                        var rbdInfo = new RebuildInfo();
                        pmName = rbdInfo.GetRebuildInfo(projectId).PMNameENUS;
                    }
                    else if (projectId.ToLower().IndexOf("majorlease") != -1)
                    {
                        var mjInfo = new MajorLeaseInfo();
                        pmName = mjInfo.GetMajorLeaseInfo(projectId).PMNameENUS;
                    }
                    else if (projectId.ToLower().IndexOf("reimage") != -1)
                    {
                        pmName = ReimageInfo.GetReimageInfo(projectId).PMNameENUS;
                    }
                    inputInfo.PMNameENUS = pmName;
                    break;

                case ExcelDataInputType.ClosureWOCheckList:
                    var closure = ClosureInfo.GetByProjectId(projectId);
                    if (closure != null)
                    {
                        inputInfo.ActualCloseDate = closure.ActualCloseDate.HasValue ? closure.ActualCloseDate.Value.ToString("yyyy-MM-dd") : "";
                        inputInfo.PMNameENUS      = closure.PMNameENUS;
                    }
                    break;
                }

                excelOutputDirector.Input(inputInfo);
            }

            current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + SiteFilePath.GetTemplateFileName(projectInfo.USCode, flowCode, siteFilePath));
            current.Response.ContentType = "application/octet-stream";
            current.Response.WriteFile("" + tempFilePath + "");
            current.Response.End();

            return(Ok());
        }
コード例 #5
0
ファイル: DLController.cs プロジェクト: XiaoYaTech/Demo
        public IHttpActionResult GetAttachments(Guid Id, string flowCode)
        {
            var refTableId   = string.Empty;
            var refTableName = string.Empty;
            var projectInfo  = ProjectInfo.Get(Id);

            if (projectInfo != null)
            {
                switch (flowCode)
                {
                case FlowCode.Closure:
                    refTableName = "ClosureInfo";
                    var closureInfo = ClosureInfo.GetByProjectId(projectInfo.ProjectId);
                    if (closureInfo != null)
                    {
                        refTableId = closureInfo.Id.ToString();
                    }
                    break;

                case FlowCode.Rebuild:
                    refTableName = "RebuildInfo";
                    var rebuildInfo = RebuildInfo.FirstOrDefault(i => i.ProjectId == projectInfo.ProjectId);
                    if (rebuildInfo != null)
                    {
                        refTableId = rebuildInfo.Id.ToString();
                    }
                    break;

                case FlowCode.MajorLease:
                    refTableName = "MajorLeaseInfo";
                    var majorLeaseInfo = MajorLeaseInfo.FirstOrDefault(i => i.ProjectId == projectInfo.ProjectId);
                    if (majorLeaseInfo != null)
                    {
                        refTableId = majorLeaseInfo.Id.ToString();
                    }
                    break;

                case FlowCode.Renewal:
                    refTableName = "RenewalInfo";
                    var renewalInfo = RenewalInfo.Get(projectInfo.ProjectId);
                    if (renewalInfo != null)
                    {
                        refTableId = renewalInfo.Id.ToString();
                    }
                    break;

                case FlowCode.Reimage:
                    refTableName = "ReimageInfo";
                    var reimageInfo = ReimageInfo.GetReimageInfo(projectInfo.ProjectId);
                    if (reimageInfo != null)
                    {
                        refTableId = reimageInfo.Id.ToString();
                    }
                    break;
                }
                if (!string.IsNullOrEmpty(refTableId))
                {
                    var list = Attachment.Search(i => i.RefTableName == refTableName && i.RefTableID == refTableId).ToList();
                    foreach (var item in list)
                    {
                        item.FileURL = SiteInfo.ServiceUrl + "api/attachment/download?id=" + item.ID;
                    }
                    return(Ok(list));
                }
            }
            return(Ok());
        }