예제 #1
0
        /// <summary>
        /// 保存成果信息
        /// </summary>
        public void Save()
        {
            var entites = FormulaHelper.GetEntities <ProjectEntities>();

            this.Validate();

            if (entites.Entry(this).State == EntityState.Detached || entites.Entry(this).State == EntityState.Added)
            {
                var user = FormulaHelper.GetUserInfo();
                if (String.IsNullOrEmpty(this.WBSFullID))
                {
                    this.WBSFullID = this.S_W_WBS.FullID;
                }
                if (String.IsNullOrEmpty(this.FullID))
                {
                    this.FullID = this.ID;
                }
                if (String.IsNullOrEmpty(this.ProjectInfoID))
                {
                    this.ProjectInfoID = this.S_W_WBS.ProjectInfoID;
                }
                this.PrintState   = "UnPrint";
                this.ArchiveState = TrueOrFalse.False.ToString();
                this.SignState    = TrueOrFalse.False.ToString();
                this.IsCoSign     = "";
                this.CoSignState  = Project.Logic.CoSignState.NoSign.ToString();
                this.AuditState   = Project.Logic.AuditState.Create.ToString();
                this.State        = ProductState.Create.ToString();
                this.CreateDate   = DateTime.Now;
                this.CreateUser   = user.UserName;
                this.CreateUserID = user.UserID;
                this.SubmitDate   = DateTime.Now;
                var majorNode = this.S_W_WBS.Seniorities.FirstOrDefault(d => d.WBSType == WBSNodeType.Major.ToString());
                if (majorNode != null)
                {
                    this.MajorValue = majorNode.WBSValue;
                    if (majorNode.Parent.WBSType == WBSNodeType.SubProject.ToString())
                    {
                        this.SubProjectInfo = majorNode.Parent.Name;
                    }
                }
                if (!this.Version.HasValue)
                {
                    this.Version = 1;
                }

                var version = new S_E_ProductVersion();
                FormulaHelper.UpdateModel(version, this);
                version.ID          = FormulaHelper.CreateGuid();
                version.S_E_Product = this;
                version.ProductID   = this.ID;
                this.S_E_ProductVersion.Add(version);
                entites.S_E_Product.Add(this);
            }
            else
            {
                UpdateVersison();
                SynMeetingSignProducts();
            }
        }
예제 #2
0
        public void Upgrade()
        {
            if (this.AuditState != Project.Logic.AuditState.Pass.ToString())
            {
                throw new Exception("成果【" + this.Name.ToString() + "】正在校审中无法升版。");
            }
            if (this.CoSignState == Project.Logic.CoSignState.Sign.ToString())
            {
                throw new Exception("成果【" + this.Name.ToString() + "】正在会签中无法升版。");
            }
            this.BatchID             = "";
            this.AuditID             = "";
            this.ChangeAuditID       = "";
            this.AuditState          = Project.Logic.AuditState.Create.ToString();
            this.AuditPassDate       = null;
            this.ArchiveState        = "False";
            this.ArchiveDate         = null;
            this.SignState           = "False";
            this.CoSignState         = "NoSign";
            this.CoSignDate          = null;
            this.PrintState          = "UnPrint";
            this.Designer            = "";
            this.DesignerName        = "";
            this.Collactor           = "";
            this.CollactorName       = "";
            this.Auditor             = "";
            this.AuditorName         = "";
            this.Approver            = "";
            this.ApproverName        = "";
            this.AuditSignUser       = null;
            this.CoSignUser          = null;
            this.CounterSignAuditID  = "";
            this.PDFSignPositionInfo = null;
            this.PDFAuditFiles       = null;
            this.PlotSealGroup       = "";
            this.PlotSealGroupName   = "";
            this.PlotSealGroupKey    = "";
            this.SignPdfFile         = "";
            this.FrameAllAttInfo     = null;

            var version = new S_E_ProductVersion();

            FormulaHelper.UpdateModel(version, this);
            version.ID          = FormulaHelper.CreateGuid();
            version.S_E_Product = this;
            version.ProductID   = this.ID;
            var preVersion = this.S_E_ProductVersion.OrderByDescending(d => d.Version).FirstOrDefault();

            if (preVersion == null)
            {
                version.Version = 1;
            }
            else
            {
                version.Version = preVersion.Version.HasValue ? Math.Floor(preVersion.Version.Value) + 1M : 1;
            }
            this.S_E_ProductVersion.Add(version);
            this.Version = version.Version;
            SynMeetingSignProducts();
        }
예제 #3
0
        public void Change(string mainFile, string printFile, string attachments, string exploreFile)
        {
            if (this.S_W_WBS.WBSType == WBSNodeType.Work.ToString())
            {
                var task = this.S_W_WBS.S_W_TaskWork.FirstOrDefault();
                if (task != null && task.ChangeState != TaskWorkChangeState.ApplyFinish.ToString() &&
                    task.ChangeState != TaskWorkChangeState.AuditStart.ToString())
                {
                    throw new Formula.Exceptions.BusinessException("只有卷册变更申请完成,成果才能进行变更");
                }
            }
            if (this.AuditState != Project.Logic.AuditState.Pass.ToString())
            {
                throw new Formula.Exceptions.BusinessException("只有校审通过的成果才能变更");
            }
            if (this.State != ProductState.Create.ToString())
            {
                throw new Formula.Exceptions.BusinessException("只有未变更或未作废的成果才能变更");
            }

            var version = new S_E_ProductVersion();

            FormulaHelper.UpdateModel(version, this);
            version.ID          = FormulaHelper.CreateGuid();
            version.S_E_Product = this;
            version.ProductID   = this.ID;
            version.Attachments = attachments;
            version.MainFile    = mainFile;
            version.PdfFile     = printFile;
            version.SwfFile     = exploreFile;
            var preVersion = this.S_E_ProductVersion.OrderByDescending(d => d.Version).FirstOrDefault();

            if (preVersion == null)
            {
                version.Version = 1;
            }
            else
            {
                version.Version = preVersion.Version.HasValue ? Math.Floor(preVersion.Version.Value) + 1M : 1;
            }
            this.S_E_ProductVersion.Add(version);
            this.MainFile    = version.MainFile;
            this.PdfFile     = version.PdfFile;
            this.Attachments = version.Attachments;
            this.SwfFile     = version.SwfFile;
            this.Version     = version.Version;
            this.AuditState  = Project.Logic.AuditState.Create.ToString();
            this.State       = ProductState.Change.ToString();
            SynMeetingSignProducts();
        }