/// <summary> /// 增加一条数据 /// </summary> public bool Add(KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into StandardOperateProcedure("); strSql.Append("SOPID,SOPName,SOPWaitTimeLength,DesControllerInfoInLANID,Action,OutPutLength)"); strSql.Append(" values ("); strSql.Append("@SOPID,@SOPName,@SOPWaitTimeLength,@DesControllerInfoInLANID,@Action,@OutPutLength)"); SqlParameter[] parameters = { new SqlParameter("@SOPID", SqlDbType.Int, 4), new SqlParameter("@SOPName", SqlDbType.NVarChar, 50), new SqlParameter("@SOPWaitTimeLength", SqlDbType.Int, 4), new SqlParameter("@DesControllerInfoInLANID", SqlDbType.Int, 4), new SqlParameter("@Action", SqlDbType.NVarChar, 100), new SqlParameter("@OutPutLength", SqlDbType.Int, 4) }; parameters[0].Value = model.SOPID; parameters[1].Value = model.SOPName; parameters[2].Value = model.SOPWaitTimeLength; parameters[3].Value = model.DesControllerInfoInLANID; parameters[4].Value = model.Action; parameters[5].Value = model.OutPutLength; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure DataRowToModel(DataRow row) { KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure model = new KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure(); if (row != null) { if (row["SOPID"] != null && row["SOPID"].ToString() != "") { model.SOPID = int.Parse(row["SOPID"].ToString()); } if (row["SOPName"] != null) { model.SOPName = row["SOPName"].ToString(); } if (row["SOPWaitTimeLength"] != null && row["SOPWaitTimeLength"].ToString() != "") { model.SOPWaitTimeLength = int.Parse(row["SOPWaitTimeLength"].ToString()); } if (row["DesControllerInfoInLANID"] != null && row["DesControllerInfoInLANID"].ToString() != "") { model.DesControllerInfoInLANID = int.Parse(row["DesControllerInfoInLANID"].ToString()); } if (row["Action"] != null) { model.Action = row["Action"].ToString(); } if (row["OutPutLength"] != null && row["OutPutLength"].ToString() != "") { model.OutPutLength = int.Parse(row["OutPutLength"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update StandardOperateProcedure set "); strSql.Append("SOPName=@SOPName,"); strSql.Append("SOPWaitTimeLength=@SOPWaitTimeLength,"); strSql.Append("DesControllerInfoInLANID=@DesControllerInfoInLANID,"); strSql.Append("Action=@Action,"); strSql.Append("OutPutLength=@OutPutLength"); strSql.Append(" where SOPID=@SOPID "); SqlParameter[] parameters = { new SqlParameter("@SOPName", SqlDbType.NVarChar, 50), new SqlParameter("@SOPWaitTimeLength", SqlDbType.Int, 4), new SqlParameter("@DesControllerInfoInLANID", SqlDbType.Int, 4), new SqlParameter("@Action", SqlDbType.NVarChar, 100), new SqlParameter("@OutPutLength", SqlDbType.Int, 4), new SqlParameter("@SOPID", SqlDbType.Int, 4) }; parameters[0].Value = model.SOPName; parameters[1].Value = model.SOPWaitTimeLength; parameters[2].Value = model.DesControllerInfoInLANID; parameters[3].Value = model.Action; parameters[4].Value = model.OutPutLength; parameters[5].Value = model.SOPID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure GetModel(int SOPID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 SOPID,SOPName,SOPWaitTimeLength,DesControllerInfoInLANID,Action,OutPutLength from StandardOperateProcedure "); strSql.Append(" where SOPID=@SOPID "); SqlParameter[] parameters = { new SqlParameter("@SOPID", SqlDbType.Int, 4) }; parameters[0].Value = SOPID; KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure model = new KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure DataRowToModel(DataRow row) { KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure model=new KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure(); if (row != null) { if(row["SOPID"]!=null && row["SOPID"].ToString()!="") { model.SOPID=int.Parse(row["SOPID"].ToString()); } if(row["SOPName"]!=null) { model.SOPName=row["SOPName"].ToString(); } if(row["SOPWaitTimeLength"]!=null && row["SOPWaitTimeLength"].ToString()!="") { model.SOPWaitTimeLength=int.Parse(row["SOPWaitTimeLength"].ToString()); } if(row["DesControllerInfoInLANID"]!=null && row["DesControllerInfoInLANID"].ToString()!="") { model.DesControllerInfoInLANID=int.Parse(row["DesControllerInfoInLANID"].ToString()); } if(row["Action"]!=null) { model.Action=row["Action"].ToString(); } if(row["OutPutLength"]!=null && row["OutPutLength"].ToString()!="") { model.OutPutLength=int.Parse(row["OutPutLength"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure GetModel(int SOPID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 SOPID,SOPName,SOPWaitTimeLength,DesControllerInfoInLANID,Action,OutPutLength from StandardOperateProcedure "); strSql.Append(" where SOPID=@SOPID "); SqlParameter[] parameters = { new SqlParameter("@SOPID", SqlDbType.Int,4) }; parameters[0].Value = SOPID; KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure model=new KryptonAccessController.AccessDataBase.Model.StandardOperateProcedure(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }