public override bool Update(QcDbTransaction trans) { if (IsNew()) { this["检查项编码"] = Parent.Code; this["标准检查项编码"] = Parent["标准检查项编码"]; this["算子编码"] = CheckOperator.Code; this["产品类别编码"] = Parent.Parent.Parent.Parent.Code; this["产品级别编码"] = Parent.Parent.Parent.Parent.Parent.Code; } //QcLog.LogString("Start QcProductOperator Update "+this.Name ); bool ret = base.Update(trans); if (ret == false && IsNew()) { //QcLog.LogString("QcProductOperator Update Fail! "+this.Name ); this["检查项编码"] = ""; } if (ret) { if (Parent.Nodes.Contains(this)) { Parent.Nodes.Add(this); } } return(ret); }
public override bool Update(QcDbTransaction trans = null) { if (IsNew()) { this.Code = Parent.GetNextPartCode(); } 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.Nodes.Contains(this) == false) { if ((Parent.Nodes.Any(t => t.Code == this.Code)) == false) { Parent.Nodes.Add(this); } } return(true); }
public override bool Update(QcDbTransaction trans) { if (IsNew()) { this.Code = Parent.GetNextPartCode(); } //QcLog.LogString("Start QcQuaelement Update"+this.Name ); bool ret = base.Update(trans); if (ret == false && IsNew()) { // QcLog.LogString("QcQuaelement Update Fail! " + this.Name); this.Code = ""; return(false); } if (Nodes.ToArray().Any(t => t.Update(trans) == false)) { if (IsNew()) { this.Code = ""; } return(false); } if (ret) { if (Parent.Nodes.Contains(this) == false) { Parent.Nodes.Add(this); } } return(ret); }
/// <summary> /// 从数据库中删除数据行 /// </summary> /// <param name="trans">事务支持类</param> /// <returns></returns> public virtual bool DeleteFromDb(QcDbTransaction trans = null) { if (row.RowState == DataRowState.Detached)//分离行 { return(true); } if (tablename == null) { return(false); } bool returnvalue = true; string Sql = MakeDeleteSql(); if (trans != null) { returnvalue = trans.Execute(Sql); } else { returnvalue = DbHelper.Execute(Sql); } if (returnvalue) { row.AcceptChanges(); } return(returnvalue); }
public override bool Update(QcDbTransaction trans = null) { if (IsNew()) { this.Code = Parent.GetNextPrjCode(); this["产品类别编码"] = Parent.Code; this["产品级别编码"] = Parent.Parent.Code; this["创建人"] = QcUser.User.UserID; this["修改日期"] = DateTime.Now.ToLongTimeString(); } 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.PrjNodes.Contains(this) == false) { if ((Parent.PrjNodes.Any(t => t.Code == this.Code)) == false) { Parent.PrjNodes.Add(this); } } return(true); }
public override bool Update(QcDbTransaction trans = null) { if (IsNew()) { this.Code = Parent.GetNextPartCode(); } bool ret = base.Update(trans); if (ret == false && IsNew()) { this.Code = ""; return(false); } //////////////////////////oct修改 为什么要遍历修改子元素呢 //if (Nodes.Any(t => t.Update(trans) == false)) //{ // if (IsNew()) this.Code = ""; // return false; //} //////////////////////////oct修改 为什么要扁率修改子元素呢 //if(Parent.Nodes.Contains(this)==false) if ((Parent.Nodes.Any(t => t.Code == this.Code)) == false) { Parent.Nodes.Add(this); } return(true); }
public override bool DeleteFromDb(QcDbTransaction trans = null) { if (Users.Contains(this)) { Users.Remove(this); } return(base.DeleteFromDb(trans)); }
public override bool Update(QcDbTransaction trans = null) { if (IsNew()) { this.Code = this.GetNextCode(); } return(base.Update(trans)); }
public override bool Update(QcDbTransaction trans = null) { bool isnew = false; if (IsNew()) { } return(base.Update(trans)); }
public override bool DeleteFromDb(QcDbTransaction trans) { bool ret = base.DeleteFromDb(trans); if (ret) { Parent.Nodes.Remove(this); } return(ret); }
public override bool DeleteFromDb(QcDbTransaction trans = null) { /// 遍历删除子元素 bool ret; //利用数据库外键约束删除规则,不需要用代码控制删除 ret = base.DeleteFromDb(trans); //if (ret) Parent.PrjNodes.Remove(this); return(ret); }
public override bool Update(QcDbTransaction trans = null) { bool isnew = false; if (IsNew()) { isnew = true; this.Code = this.GetNextCode(); } return(base.Update(trans)); }
public override bool DeleteFromDb(QcDbTransaction trans = null) { if (base.DeleteFromDb(trans)) { InitRole(); return(true); } else { return(false); } }
public override bool DeleteFromDb(QcDbTransaction trans = null) { /// 遍历删除子元素 bool ret; /// 遍历删除子元素 ret = base.DeleteFromDb(trans); if (ret && Parent != null) { Parent.Nodes.Remove(this); } return(ret); }
/// <summary> /// /// </summary> public override bool Update(QcDbTransaction trans = null) { bool isnew = this.IsNew(); bool ret = base.Update(trans); if (ret) { if (NodeUpdateToDb != null) { NodeUpdateToDb(this, new QcNodeEventArg(this, isnew ? NodeChangeType.Create : NodeChangeType.Update)); } } return(ret); }
public override bool DeleteFromDb(QcDbTransaction trans) { if (Nodes.ToArray().Any(t => t.DeleteFromDb(trans) == false)) { return(false); } bool ret = base.DeleteFromDb(trans); if (ret) { Parent.Nodes.Remove(this); } return(ret); }
public override bool DeleteFromDb(QcDbTransaction trans = null) { bool ret; /// 遍历删除子元素 if (Nodes.ToArray().Any(t => t.DeleteFromDb(trans) == false)) { return(false); } ret = base.DeleteFromDb(trans); if (ret) { QcProductLevels.Remove(this); } return(ret); }
public override bool DeleteFromDb(QcDbTransaction trans = null) { /// 遍历删除子元素 bool ret; /// 遍历删除子元素 if (Nodes.ToList().Any(t => t.DeleteFromDb(trans) == false)) { return(false); } ret = base.DeleteFromDb(trans); if (ret) { Parent.Nodes.Remove(this); } return(ret); }
public override bool Update(QcDbTransaction trans = null) { //////////////////////////oct修改 为什么要遍历修改子元素呢 //if (Nodes.Any(t => t.Update(trans) == false)) return false; //////////////////////////oct修改 为什么要遍历修改子元素呢 bool ret = base.Update(trans); if (ret) { if (QcProductLevels.Contains(this) == false) { QcProductLevel.QcProductLevels.Add(this); } } return(ret); }
public override bool Update(QcDbTransaction trans = null) { if (IsNew()) { this.Code = QcDepartment.GetNextCode(); } bool ret = base.Update(trans); if (ret == false && IsNew()) { this.Code = ""; } if (!Departments.Contains(this)) { Departments.Add(this); } return(ret); }
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 DeleteFromDb(QcDbTransaction trans = null) { bool isnew = this.IsNew(); if (isnew) { return(true); } bool ret = base.DeleteFromDb(); if (ret) { if (NodeUpdateToDb != null) { NodeUpdateToDb(this, new QcNodeEventArg(this, NodeChangeType.Delete)); } } return(ret); }
public override bool Update(QcDbTransaction trans = null) { if (IsNew()) { this.Code = QcPermissionEnum.GetNextCode(); } bool ret = base.Update(trans); if (ret == false && IsNew()) { this.Code = ""; } //新建的加入到列表 if (ret && !Permissions.Contains(this)) { Permissions.Add(this); } return(ret); }
public override bool Update(QcDbTransaction trans = null) { if (IsNew()) { this.Code = QcUser.GetNextCode(); this["用户密码"] = QcEncrypt.Md5Hash(this.UserName + QcEncrypt.Md5Hash(this["用户密码"])); } bool ret = base.Update(trans); //子节点调用AddRole 和RemoveRole进行同步,此处不管 if (ret == false && IsNew()) { this.Code = ""; } if (ret && !Users.Contains(this)) { Users.Add(this); } //if (ret && !Users.Any(t=>t.UserName==this.UserName)) Users.Add(this); return(ret); }
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); }
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); }
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); }
public bool UpdatebyID(string code, QcDbTransaction trans = null) { if (IsNew()) { this.Code = code; } 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); } return(true); }
public override bool DeleteFromDb(QcDbTransaction trans = null) { Departments.Remove(this); return(base.DeleteFromDb(trans)); }
/// <summary> /// 更新数据到数据库 /// </summary> /// <returns></returns> public virtual bool Update(QcDbTransaction trans = null) { if (tablename == null) { return(false); } bool returnvalue = true; string Sql = null; var cols = row.Table.Columns; if (row.RowState == DataRowState.Detached) { if (cols.Contains("创建人")) { if (this["创建人"] != "" && QcUser.User != null) { this["创建人"] = QcUser.User.UserID; } } if (cols.Contains("创建日期")) { this["创建日期"] = QcDate.DateString(); } Sql = MakeInsertSql(); if (trans != null) { returnvalue = trans.Execute(Sql); } else { returnvalue = DbHelper.Execute(Sql); } this.Refresh(); } else if (row.RowState == DataRowState.Modified) { if (cols.Contains("修改人")) { if (QcUser.User != null) { this["修改人"] = QcUser.User.UserID; } } if (cols.Contains("修改日期")) { this["修改日期"] = QcDate.DateString(); } Sql = MakeUpdateSql(); if (trans != null) { returnvalue = trans.Execute(Sql); } else { returnvalue = DbHelper.Execute(Sql); } if (returnvalue) { row.AcceptChanges(); } } return(returnvalue); }