/// <summary> /// 更新一条数据 /// </summary> public bool Update(LPWeb.Model.MailChimpCampaigns model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update MailChimpCampaigns set "); strSql.Append("Name=@Name,"); strSql.Append("BranchId=@BranchId"); strSql.Append(" where CID=@CID "); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 255), new SqlParameter("@BranchId", SqlDbType.Int, 4), new SqlParameter("@CID", SqlDbType.NVarChar, 255) }; parameters[0].Value = model.Name; parameters[1].Value = model.BranchId; parameters[2].Value = model.CID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(LPWeb.Model.MailChimpCampaigns model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into MailChimpCampaigns("); strSql.Append("CID,Name,BranchId)"); strSql.Append(" values ("); strSql.Append("@CID,@Name,@BranchId)"); SqlParameter[] parameters = { new SqlParameter("@CID", SqlDbType.NVarChar, 255), new SqlParameter("@Name", SqlDbType.NVarChar, 255), new SqlParameter("@BranchId", SqlDbType.Int, 4) }; parameters[0].Value = model.CID; parameters[1].Value = model.Name; parameters[2].Value = model.BranchId; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public LPWeb.Model.MailChimpCampaigns GetModel(string CID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CID,Name,BranchId from MailChimpCampaigns "); strSql.Append(" where CID=@CID "); SqlParameter[] parameters = { new SqlParameter("@CID", SqlDbType.NVarChar, 255) }; parameters[0].Value = CID; LPWeb.Model.MailChimpCampaigns model = new LPWeb.Model.MailChimpCampaigns(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["CID"] != null && ds.Tables[0].Rows[0]["CID"].ToString() != "") { model.CID = ds.Tables[0].Rows[0]["CID"].ToString(); } if (ds.Tables[0].Rows[0]["Name"] != null && ds.Tables[0].Rows[0]["Name"].ToString() != "") { model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); } if (ds.Tables[0].Rows[0]["BranchId"] != null && ds.Tables[0].Rows[0]["BranchId"].ToString() != "") { model.BranchId = int.Parse(ds.Tables[0].Rows[0]["BranchId"].ToString()); } return(model); } else { return(null); } }