Пример #1
0
        public void Save(string action = "")
        {
            using (var scope = new TransactionScope())
            {
                if (Id == Guid.Empty)
                {
                    Id                = Guid.NewGuid();
                    CreateTime        = DateTime.Now;
                    LastUpdateTime    = DateTime.Now;
                    CreateUserAccount = ClientCookie.UserCode;

                    IsHistory = false;

                    Add(this);
                }
                else
                {
                    LastUpdateTime = DateTime.Now;
                    Update(this);
                }
                if (ReinBasicInfo != null)
                {
                    ReinBasicInfo.ConsInfoID = Id;
                    ReinBasicInfo.Save();

                    //同步更新GBDate与ReopenDate
                    var reimageInfo = ReimageInfo.GetReimageInfo(ProjectId);
                    reimageInfo.ReopenDate = ReinBasicInfo.ReopenDate;
                    reimageInfo.GBDate     = ReinBasicInfo.GBDate;
                    reimageInfo.Update();
                }

                if (ReinCost != null)
                {
                    ReinCost.ConsInfoID = Id;
                    ReinCost.Save();
                }

                if (WriteOff != null)
                {
                    WriteOff.ConsInfoID = Id;
                    WriteOff.Save();
                }
                SaveApproveUsers(action);
                if (string.Compare(action, "edit", true) != 0)
                {
                    SaveComments(action);
                }
                scope.Complete();
            }
        }
Пример #2
0
        public void Save(string action = "")
        {
            using (var scope = new TransactionScope())
            {
                if (Id == Guid.Empty)
                {
                    Id                 = Guid.NewGuid();
                    CreateTime         = DateTime.Now;
                    LastUpdateTime     = DateTime.Now;
                    CreateUserAccount  = ClientCookie.UserCode;
                    CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                    CreateUserNameENUS = ClientCookie.UserNameENUS;
                    IsHistory          = false;
                    Add(this);
                }
                else
                {
                    LastUpdateTime = DateTime.Now;
                    Update(this);
                }
                if (ReinBasicInfo != null)
                {
                    ReinBasicInfo.ConsInfoID = Id;
                    ReinBasicInfo.Save();
                    var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == ProjectId);
                    if (rbdInfo != null)
                    {
                        rbdInfo.GBDate              = ReinBasicInfo.GBDate;
                        rbdInfo.ReopenDate          = ReinBasicInfo.ReopenDate;
                        rbdInfo.ConstCompletionDate = ReinBasicInfo.ConsCompletionDate;
                        rbdInfo.Update();
                    }
                }

                if (ReinCost != null)
                {
                    ReinCost.ConsInfoID = Id;
                    ReinCost.SaveByRebuild();
                }

                if (WriteOff != null)
                {
                    WriteOff.ConsInfoID = Id;
                    WriteOff.SaveByRebuild();
                }

                SaveApproveUsers(action);
                SaveComments(action);
                scope.Complete();
            }
        }