/// <summary> /// 更新一条数据 /// </summary> public bool UpdateResourceID(AdRelease model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update AdRelease set "); strSql.Append(" ResourceID = @ResourceID , "); strSql.Append(" RecordUpdateUserID = @RecordUpdateUserID , "); strSql.Append(" RecordUpdateTime = GetDate(), "); strSql.Append(" where AdReleaseID=@AdReleaseID"); SqlParameter[] parameters = { new SqlParameter("@AdReleaseID", model.AdReleaseID), new SqlParameter("@ResourceID", model.ResourceID), new SqlParameter("@RecordUpdateUserID", model.RecordUpdateUserID) }; int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public void GetAdReleaseOne(HttpContext context) { var AdReleaseID = context.Request.QueryString["AdReleaseID"]; AdReleaseBLL bll = new AdReleaseBLL(); AdRelease a = new AdRelease(); if (!string.IsNullOrEmpty(AdReleaseID)) { a = bll.GetModelOne(Convert.ToInt32(AdReleaseID)); } context.Response.Write(SerializerHelper.SerializeObject(a)); }
/// <summary> /// 更新一条数据 /// </summary> public bool UpdateResourceID(AdRelease model) { return(dal.UpdateResourceID(model)); }
public bool ResourceAdd(int ResourceID, int AdPositionID, AdRelease AdRelease, string TPath, out string msg, byte[] fileData = null, string fileName = "") { msg = "true"; using (SqlConnection conn = new SqlConnection(BWJSHelperSQL.connectionString)) { conn.Open(); using (SqlTransaction trans = conn.BeginTransaction()) { try { if (ResourceID == 0) { ResourceID = SaveFile(fileName, fileData, TPath); } if (ResourceID > 0) { AdReleaseBLL AdReleasebll = new AdReleaseBLL(); AdRelease.ResourceID = ResourceID; AdRelease.RecordUpdateUserID = 1; int AdReleaseID = 0; if (AdRelease.AdReleaseID > 0) { AdReleaseID = Convert.ToInt32(AdReleasebll.Update(AdRelease)); } else { AdReleaseID = AdReleasebll.Add(AdRelease); AdRelease.AdReleaseID = AdReleaseID; } //bool b = AdReleasebll.UpdateResourceID(AdRelease); if (AdReleaseID > 0) { if (AdPositionID > 0) { AdPositionBLL bll = new AdPositionBLL(); bool c = false; bll.BackUpdate(AdRelease.AdReleaseID); c = bll.UpdateAdReleaseID(AdRelease.AdReleaseID, AdPositionID); if (c) { trans.Commit(); return(true); } else { msg = "广告绑定失败!"; return(false); } } else { msg = "广告位选定失败!"; return(false); } } else { msg = "广告资源添加失败!"; return(false); } } else { msg = "资源保存失败!"; return(false); } } catch (Exception e) { ExceptionLogBLL.WriteExceptionLogToDB(e.ToString()); trans.Rollback(); msg = "False"; return(false); } } } }