Beispiel #1
0
 public bool InsertPmsSdpVersion(PmsSdpVersion pmsSdpVersion)
 {
     try
     {
         m_PMSSqlConnection.Insert("InsertPmsSdpVersion", pmsSdpVersion);
         return(true);
     }
     catch (Exception ex)
     {
         m_Logger.Error("PmsSdpVersionBiz/InsertPmsSdpVersion:" + ex.ToString());
         return(false);
     }
 }
Beispiel #2
0
        public bool UpdatePmsSdpVersionByTaskno(PmsSdpVersion pmsSdpVersion)
        {
            bool updateResult = false;

            try
            {
                m_PMSSqlConnection.Update("UpdatePmsSdpVersionByTaskno", pmsSdpVersion);
                updateResult = true;
            }
            catch (Exception ex)
            {
                m_Logger.Error("SdpDetailBiz/UpdatePmsSdpVersionByTaskno:" + ex.ToString());
            }
            return(updateResult);
        }
Beispiel #3
0
        public bool UpdateSdpDetailAuditStatus(string serials, int auditStatus, string auditComment)
        {
            bool result = false;

            string[]    serialArray = serials.Split(';');
            string      serialAll   = serialArray.Aggregate(string.Empty, (current, next) => current + "'" + next + "',").TrimEnd(',');
            SdpDetail   sdpDetail   = new SdpDetail();
            PmsSdpAudit pmsSdpAudit = new PmsSdpAudit();

            sdpDetail.Serials     = serialAll;
            sdpDetail.AuditStatus = auditStatus;
            if (new SdpDetailBiz().UpdateSdpDetailAuditStatus(sdpDetail))
            {
                //同意或拒绝会新增版本
                if ((auditStatus == (int)PmsCommonEnum.AuditStatus.HasApproved) || auditStatus == (int)PmsCommonEnum.AuditStatus.BeenRejected)
                {
                    PmsSdpVersion pmsSdpVersion = new PmsSdpVersion();
                    foreach (var serial in serialArray)
                    {
                        IList <PmsSdpVersion> PmsSdpVersionList = new PmsSdpVersionBiz().SelectPmsSdpVersionByTaskno(serial);
                        IList <SdpDetail>     listSdpDetail     = new SdpDetailBiz().SelectSdpDetail(new SdpDetail {
                            Serial = int.Parse(serial)
                        });
                        if (listSdpDetail == null || listSdpDetail.Count == 0)
                        {
                            return(result);
                        }
                        sdpDetail                  = listSdpDetail.FirstOrDefault();
                        pmsSdpVersion.Taskno       = int.Parse(serial);
                        pmsSdpVersion.Pmsid        = sdpDetail.Pmsid;
                        pmsSdpVersion.PlanStartDay = sdpDetail.Planstartday;
                        pmsSdpVersion.PlanEndDay   = sdpDetail.Planendday;
                        pmsSdpVersion.PlanCost     = (float)sdpDetail.Plancost;
                        pmsSdpVersion.RefCost      = (float)sdpDetail.Refcost;
                        pmsSdpVersion.Creator      = LoginName;
                        pmsSdpVersion.CreateDate   = DateTime.Now;
                        pmsSdpVersion.Version      = (PmsSdpVersionList == null || PmsSdpVersionList.Count == 0) ? 1.0f : PmsSdpVersionList.Max(t => t.Version) + 0.1f;
                        new PmsSdpVersionBiz().InsertPmsSdpVersion(pmsSdpVersion);
                    }
                    IList <PmsSdpAudit> pmsSdpAuditList = new PmsSdpAuditBiz().SelectPmsSdpAuditByPmsId(sdpDetail.Pmsid);
                    pmsSdpAudit.Pmsid      = sdpDetail.Pmsid;
                    pmsSdpAudit.SdpVersion = (pmsSdpAuditList == null || pmsSdpAuditList.Count == 0) ? 1.0f : pmsSdpAuditList.Max(t => t.SdpVersion) + 0.1f;
                    pmsSdpAudit.Auditor    = LoginName;
                    if (auditComment == "")
                    {
                        pmsSdpAudit.AuditResult = "Approve";
                    }
                    else
                    {
                        pmsSdpAudit.AuditResult = "Reject";
                    }
                    pmsSdpAudit.AuditComment = auditComment;
                    pmsSdpAudit.CreateDate   = DateTime.Now;
                    pmsSdpAudit.Creator      = LoginName;
                    new PmsSdpAuditBiz().InsertPmsSdpAudit(pmsSdpAudit);
                }

                //发mail通知相关人员(提交人或者审核人)
                result = new MailBiz().TaskMail(serialArray[0], auditStatus);
            }
            return(result);
        }