Ejemplo n.º 1
0
        public string GenerateAttachment()
        {
            var    records      = RenewalLLNegotiationRecord.GetRecords(Id);
            var    templateName = HttpContext.Current.Server.MapPath("~/Template/Renewal_LLNegotiationRecord_Template.xlsx");
            string fileName     = string.Concat(HttpContext.Current.Server.MapPath("~/UploadFiles/"), Guid.NewGuid(), ".xlsx");

            File.Copy(templateName, fileName);
            FileInfo file = new FileInfo(fileName);
            ExcelDataInputDirector excelDirector = new ExcelDataInputDirector(file, ExcelDataInputType.RenewalLLNegotiationRecord);
            List <ExcelInputDTO>   datas         = records.Select(r => new ExcelInputDTO
            {
                McdParticipants = r.McdParticipants,
                Content         = r.Content,
                LLParticipants  = r.LLParticipants,
                Topic           = r.Topic,
                Location        = r.Location,
                MeetingDate     = r.Date.Value.ToString("yyyy-MM-dd"),
                CreateDate      = r.CreateTime.ToString("yyyy-MM-dd")
            }).ToList();

            excelDirector.ListInput(datas);
            Guid       reqId = new Guid("f314bf06-f557-4893-ae78-af3b0b561885");
            Attachment att   = Attachment.Get(Id.ToString(), reqId);

            if (att == null)
            {
                att = new Attachment();
                att.InternalName    = Path.GetFileName(fileName);
                att.RefTableName    = this.TableName;
                att.RefTableID      = Id.ToString();
                att.RelativePath    = "//";
                att.Name            = "Negotiation Record List";
                att.Extension       = ".xlsx";
                att.Length          = (int)file.Length;
                att.CreateTime      = DateTime.Now;
                att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                att.CreatorNameENUS = ClientCookie.UserNameENUS;
                att.CreatorID       = ClientCookie.UserCode;
                att.ID            = Guid.NewGuid();
                att.RequirementId = reqId;
                att.TypeCode      = "";
                Attachment.Add(att);
            }
            else
            {
                att.InternalName    = Path.GetFileName(fileName);
                att.RefTableName    = this.TableName;
                att.RefTableID      = Id.ToString();
                att.RelativePath    = "//";
                att.Name            = "Negotiation Record List";
                att.Extension       = ".xlsx";
                att.Length          = (int)file.Length;
                att.CreateTime      = DateTime.Now;
                att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                att.CreatorNameENUS = ClientCookie.UserNameENUS;
                att.CreatorID       = ClientCookie.UserCode;
                Attachment.Update(att);
            }
            return(fileName);
        }
Ejemplo n.º 2
0
        public void UpdateStoreLLRecord()
        {
            var info         = RenewalInfo.Get(this.ProjectId);
            var negotiations = RenewalLLNegotiationRecord.GetRecords(this.Id);

            if (negotiations.Count > 0)
            {
                StoreSTLLRecord record = StoreSTLLRecord.Get(info.USCode);
                if (record == null)
                {
                    var storeBasic = StoreBasicInfo.GetStorInfo(info.USCode);
                    record           = new StoreSTLLRecord();
                    record.StoreCode = info.USCode;
                    record.StoreID   = storeBasic.StoreID;
                    record.Id        = Guid.NewGuid();
                }
                record.LLparticipants  = negotiations[0].LLParticipants;
                record.Location        = negotiations[0].Location;
                record.McdParticipants = negotiations[0].McdParticipants;
                record.Content         = negotiations[0].Content;
                record.CreatedTime     = negotiations[0].CreateTime;
                record.Topic           = negotiations[0].Topic;
                record.Save();
                var storeNegos = negotiations.Select(n => new StoreSTNegotiation
                {
                    Id                = Guid.NewGuid(),
                    StoreID           = record.StoreID,
                    StoreCode         = record.StoreCode,
                    IsBroker          = record.IsBroker,
                    BrokerName        = record.BrokerName,
                    DateTime          = n.Date.Value.ToString("yyyy-MM-dd"),
                    Location          = n.Location,
                    Topic             = n.Topic,
                    McdParticipants   = n.McdParticipants,
                    McdParticipantsAD = record.McdParticipantsAD,
                    LLparticipants    = n.LLParticipants,
                    Content           = n.Content,
                    CreatedTime       = n.CreateTime
                }).ToArray();
                StoreSTNegotiation.Add(storeNegos);
            }
        }
Ejemplo n.º 3
0
        public override string Edit()
        {
            var info   = RenewalInfo.Get(ProjectId);
            var entity = Duplicator.AutoCopy(this);

            entity.Id        = Guid.NewGuid();
            entity.IsHistory = false;
            entity.Add();
            this.IsHistory = true;
            this.Update();
            var records = RenewalLLNegotiationRecord.GetRecords(this.Id);

            records.ForEach(rec =>
            {
                rec.Id = Guid.NewGuid();
                rec.RenewalLLNegotiationId = entity.Id;
            });
            RenewalLLNegotiationRecord.Add(records.ToArray());
            TaskWork.Cancel(e => e.TypeCode == this.WorkflowCode && e.RefID == ProjectId && e.Status == TaskWorkStatus.UnFinish);
            ProjectInfo.Reset(ProjectId, this.WorkflowCode);
            var task = info.GenerateSubmitTask(this.WorkflowCode);

            return(task.Url);
        }