/// <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 bool RemovePermission(string PermissionName) { QcPermissionEnum pe = QcPermissionEnum.GetPermissionFromName(PermissionName); if (pe != null) { string sql = "delete QC_USE_PERMISSION where 角色编码='" + this.RoleCode + "' and 权限编码='" + pe.Code + "'"; if (DbHelper.Execute(sql)) { return(true); } else { return(false); } } return(false); }
public void UpdateToChkData() { string str = ""; if (this.得分 == QcEvaConst.未检查分数) { str = "未检查"; } else if (this.得分 == QcEvaConst.配置错误分数) { str = "配置错误"; } else { str = this.得分.ToString(); } string update = string.Format("update qc_pro_checkdata d set d.评价得分='{0}' where d.数据id='{1}'", str, this.数据ID); DbHelper.Execute(update); }
/// <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); }
static public bool WriteApointment(string prjid, string log, string taskid = "", string remark = "") { return(DbHelper.Execute(makesql(prjid, log, taskid, remark))); }
static public bool WriteApointment(string jobid, string log, string remark = "") { return(DbHelper.Execute(makesql(jobid, log, remark))); }
/// <summary> /// 清除当前作业的检查数据,请谨慎使用该方法 /// </summary> /// <returns></returns> public static void ClearnAllCheckData(QcJob job) { DbHelper.Execute("delete from " + QcCheckData.TableName + " where 作业编号='" + job.Code + "'"); }
/// <summary> /// 清除所有的检查数据,请谨慎使用该方法 /// </summary> /// <returns></returns> public static void ClearnAllCheckData() { DbHelper.Execute("delete from " + QcCheckData.TableName); }