示例#1
0
        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);
        }
示例#2
0
        public override bool DeleteFromDb(QcDbTransaction trans = null)
        {
            if (this.创建人 == "sys" && QcUser.User.Name != "sys")
            {
                return(false);
            }
            bool ret;

            /// 遍历删除子元素
            if (Nodes.ToArray().Any(t => t.DeleteFromDb(trans) == false))
            {
                return(false);
            }

            ret = base.DeleteFromDb(trans);
            if (ret)
            {
                QcProjectTimeLine.WriteApointment(this.Code, QcUser.User.Name + ":删除了项目");
            }
            return(ret);
        }
示例#3
0
        public override bool Update(QcDbTransaction trans = null)
        {
            bool isnew = false;

            if (IsNew())
            {
                isnew        = true;
                this.Code    = this.GetNextCode();
                this["修改日期"] = DateTime.Now.ToLongDateString();
                this["创建人"]  = QcUser.User.UserID;
            }
            if (Nodes.Any(t => t.Update(trans) == false))
            {
                return(false);
            }
            bool ret = base.Update(trans);

            if (ret && isnew)
            {
                QcProjectTimeLine.WriteApointment(this.Code, this.创建人 + "创建了项目");
                this.SendMessage(this.项目负责人, this.Name + "已创建,指定你为项目负责人");
            }
            return(ret);
        }