public override bool Update(QcDbTransaction trans = null) { bool isnew = false; if (IsNew()) { this.Code = this.GetNextCode(); this["创建人"] = QcUser.User.UserID; this["项目编号"] = Parent.Code; this["修改日期"] = DateTime.Now.ToLongDateString(); isnew = true; } bool ret = base.Update(trans); if (ret == false && IsNew()) { this.Code = ""; return(false); } if (Nodes.Any(t => t.Update(trans) == false)) { if (IsNew()) { this.Code = ""; } return(false); } if (Parent != null) { if (ret == true && Parent.Nodes.Contains(this) == false) { Parent.Nodes.Add(this); } } if (ret && isnew) { QcProjectTimeLine.WriteApointment(this.Parent.Code, this.创建人 + "对项目进行了确认并分配了新任务", this.Code); QcTaskTimeLine.WriteApointment(this.Code, this.创建人 + "创建了新任务"); this.SendMessage(this.任务负责人, this.Name + "任务已创建,指定你为任务负责人"); } return(ret); }
public override bool Update(QcDbTransaction trans = null) { bool isnew = false; if (IsNew()) { isnew = true; this.Code = this.GetNextCode(); this["创建人"] = QcUser.User.UserID; this["修改人"] = QcUser.User.UserID; this["任务编号"] = Parent.Code; this["项目编号"] = Parent["项目编号"]; this["修改日期"] = DateTime.Now.ToLongTimeString(); } bool ret = base.Update(trans); if (ret == false && IsNew()) { this.Code = ""; return(false); } if (Parent != null) { if (ret == true && Parent.Nodes.Contains(this) == false) { Parent.Nodes.Add(this); } } if (ret && isnew) { QcTaskTimeLine.WriteApointment(this.Parent.Code, this.创建人 + "对任务进行了确认并分配了新作业", this.Code); QcJobTimeLine.WriteApointment(this.Code, this.创建人 + "创建了新作业"); this.SendMessage(this["作业员"], this.Name + "作业已创建,指定你为作业负责人"); } return(ret); }