/// <summary> /// 更新一条数据 /// </summary> public int Update(QA_StarMod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update USR_Star set "); strSql.Append("CustomerSysNo=@CustomerSysNo,"); strSql.Append("OrderID=@OrderID,"); strSql.Append("Intro=@Intro"); strSql.Append(" where SysNo=@SysNo "); SqlCommand cmd = new SqlCommand(strSql.ToString()); SqlParameter[] parameters = { new SqlParameter("@SysNo", SqlDbType.Int, 4), new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4), new SqlParameter("@OrderID", SqlDbType.Int, 4), new SqlParameter("@Intro", SqlDbType.NVarChar, 2000) }; if (model.SysNo != AppConst.IntNull) { parameters[0].Value = model.SysNo; } else { parameters[0].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[0]); if (model.CustomerSysNo != AppConst.IntNull) { parameters[1].Value = model.CustomerSysNo; } else { parameters[1].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[1]); if (model.OrderID != AppConst.IntNull) { parameters[2].Value = model.OrderID; } else { parameters[2].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[2]); if (model.Intro != AppConst.StringNull) { parameters[3].Value = model.Intro; } else { parameters[3].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[3]); return(SqlHelper.ExecuteNonQuery(cmd, parameters)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(QA_StarMod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into USR_Star("); strSql.Append("SysNo,CustomerSysNo,OrderID,Intro)"); strSql.Append(" values ("); strSql.Append("@SysNo,@CustomerSysNo,@OrderID,@Intro)"); SqlCommand cmd = new SqlCommand(strSql.ToString()); SqlParameter[] parameters = { new SqlParameter("@SysNo", SqlDbType.Int, 4), new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4), new SqlParameter("@OrderID", SqlDbType.Int, 4), new SqlParameter("@Intro", SqlDbType.NVarChar, 2000) }; if (model.SysNo != AppConst.IntNull) { parameters[0].Value = model.SysNo; } else { parameters[0].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[0]); if (model.CustomerSysNo != AppConst.IntNull) { parameters[1].Value = model.CustomerSysNo; } else { parameters[1].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[1]); if (model.OrderID != AppConst.IntNull) { parameters[2].Value = model.OrderID; } else { parameters[2].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[2]); if (model.Intro != AppConst.StringNull) { parameters[3].Value = model.Intro; } else { parameters[3].Value = System.DBNull.Value; } cmd.Parameters.Add(parameters[3]); SqlHelper.ExecuteNonQuery(cmd, parameters); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(QA_StarMod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into USR_Star("); strSql.Append("SysNo,CustomerSysNo,OrderID,Intro)"); strSql.Append(" values ("); strSql.Append("@SysNo,@CustomerSysNo,@OrderID,@Intro)"); SqlCommand cmd = new SqlCommand(strSql.ToString()); SqlParameter[] parameters = { new SqlParameter("@SysNo",SqlDbType.Int,4), new SqlParameter("@CustomerSysNo",SqlDbType.Int,4), new SqlParameter("@OrderID",SqlDbType.Int,4), new SqlParameter("@Intro",SqlDbType.NVarChar,2000) }; if (model.SysNo != AppConst.IntNull) parameters[0].Value = model.SysNo; else parameters[0].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[0]); if (model.CustomerSysNo != AppConst.IntNull) parameters[1].Value = model.CustomerSysNo; else parameters[1].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[1]); if (model.OrderID != AppConst.IntNull) parameters[2].Value = model.OrderID; else parameters[2].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[2]); if (model.Intro != AppConst.StringNull) parameters[3].Value = model.Intro; else parameters[3].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[3]); SqlHelper.ExecuteNonQuery(cmd,parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public QA_StarMod GetModel(int SysNo) { StringBuilder strSql = new StringBuilder(); strSql.Append("select SysNo, CustomerSysNo, OrderID, Intro from USR_Star"); strSql.Append(" where SysNo=@SysNo"); SqlParameter[] parameters = { new SqlParameter("@SysNo", SqlDbType.Int, 4) }; parameters[0].Value = SysNo; QA_StarMod model = new QA_StarMod(); DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "") { model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString()); } if (ds.Tables[0].Rows[0]["CustomerSysNo"].ToString() != "") { model.CustomerSysNo = int.Parse(ds.Tables[0].Rows[0]["CustomerSysNo"].ToString()); } if (ds.Tables[0].Rows[0]["OrderID"].ToString() != "") { model.OrderID = int.Parse(ds.Tables[0].Rows[0]["OrderID"].ToString()); } model.Intro = ds.Tables[0].Rows[0]["Intro"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(QA_StarMod model) { dal.Add(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(QA_StarMod model) { dal.Update(model); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(QA_StarMod model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update USR_Star set "); strSql.Append("CustomerSysNo=@CustomerSysNo,"); strSql.Append("OrderID=@OrderID,"); strSql.Append("Intro=@Intro"); strSql.Append(" where SysNo=@SysNo "); SqlCommand cmd = new SqlCommand(strSql.ToString()); SqlParameter[] parameters = { new SqlParameter("@SysNo",SqlDbType.Int,4), new SqlParameter("@CustomerSysNo",SqlDbType.Int,4), new SqlParameter("@OrderID",SqlDbType.Int,4), new SqlParameter("@Intro",SqlDbType.NVarChar,2000) }; if (model.SysNo != AppConst.IntNull) parameters[0].Value = model.SysNo; else parameters[0].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[0]); if (model.CustomerSysNo != AppConst.IntNull) parameters[1].Value = model.CustomerSysNo; else parameters[1].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[1]); if (model.OrderID != AppConst.IntNull) parameters[2].Value = model.OrderID; else parameters[2].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[2]); if (model.Intro != AppConst.StringNull) parameters[3].Value = model.Intro; else parameters[3].Value = System.DBNull.Value; cmd.Parameters.Add(parameters[3]); return SqlHelper.ExecuteNonQuery(cmd,parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public QA_StarMod GetModel(int SysNo) { StringBuilder strSql = new StringBuilder(); strSql.Append("select SysNo, CustomerSysNo, OrderID, Intro from USR_Star"); strSql.Append(" where SysNo=@SysNo"); SqlParameter[] parameters = { new SqlParameter("@SysNo", SqlDbType.Int,4 ) }; parameters[0].Value = SysNo; QA_StarMod model = new QA_StarMod(); DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "") { model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString()); } if (ds.Tables[0].Rows[0]["CustomerSysNo"].ToString() != "") { model.CustomerSysNo = int.Parse(ds.Tables[0].Rows[0]["CustomerSysNo"].ToString()); } if (ds.Tables[0].Rows[0]["OrderID"].ToString() != "") { model.OrderID = int.Parse(ds.Tables[0].Rows[0]["OrderID"].ToString()); } model.Intro = ds.Tables[0].Rows[0]["Intro"].ToString(); return model; } else { return null; } }