/// <summary> /// 获取总记录数 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int GetTotalCount(AppInfoiosEntity entity) { string sql = string.Format(@"select count(*) from appinfo_ios tt Order By tt.AppID desc"); //nwbase_utils.TextLog.Default.Info(sql); return(MySqlHelper.ExecuteScalar(this.ConnectionString, sql).Convert <int>()); }
/// <summary> /// 获取对应总记录数 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int GetTotalAppCountByStatus(AppInfoiosEntity entity, string status) { #region CommandText StringBuilder commandText = new StringBuilder(); List <MySqlParameter> paramsList = new List <MySqlParameter>(); if (status == null || status == "" || status.Length <= 0) { commandText.Append(@"select count(a.AppID) from AppInfo_ios a where (1=1)"); } else { commandText.AppendFormat(@"select count(a.AppID) from AppInfo_ios a where (1=1) and a.Status in ({0}) ", status); } #endregion //nwbase_utils.TextLog.Default.Info(commandText.ToString()); return(MySqlHelper.ExecuteScalar(this.ConnectionString, commandText.ToString()).Convert <int>()); }
private List <MySqlParameter> GetMySqlParameters(AppInfoiosEntity entity) { List <MySqlParameter> paramsList = new List <MySqlParameter>(); paramsList.Add(new MySqlParameter("@AppID", entity.AppID)); paramsList.Add(new MySqlParameter("@AppName", entity.AppName)); paramsList.Add(new MySqlParameter("@ShowName", entity.ShowName)); paramsList.Add(new MySqlParameter("@DevName", entity.DevName)); paramsList.Add(new MySqlParameter("@AppType", entity.AppType)); paramsList.Add(new MySqlParameter("@AppSize", entity.AppSize)); paramsList.Add(new MySqlParameter("@AppPrice", entity.AppPrice)); paramsList.Add(new MySqlParameter("@AppVersion", entity.AppVersion)); paramsList.Add(new MySqlParameter("@Status", entity.Status)); paramsList.Add(new MySqlParameter("@RecommFlagWord", entity.RecommFlagWord)); paramsList.Add(new MySqlParameter("@IconPicUrl", entity.IconPicUrl)); paramsList.Add(new MySqlParameter("@ThumbPicUrl", entity.ThumbPicUrl)); paramsList.Add(new MySqlParameter("@IconUrl", entity.IconPicUrl)); paramsList.Add(new MySqlParameter("@AppPicUrl", entity.AppPicUrl)); paramsList.Add(new MySqlParameter("@AppUrl", entity.AppUrl)); paramsList.Add(new MySqlParameter("@AppDesc", entity.AppDesc)); paramsList.Add(new MySqlParameter("@RecommWord", entity.RecommWord)); paramsList.Add(new MySqlParameter("@CreateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); paramsList.Add(new MySqlParameter("@UpdateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); paramsList.Add(new MySqlParameter("@AdsPicUrl", entity.AdsPicUrl)); paramsList.Add(new MySqlParameter("@Remarks", entity.Remarks)); return(paramsList); }
/// <summary> /// 按分页取数据 /// </summary> /// <param name="entity"></param> /// <param name="status"></param> /// <returns></returns> public DataSet GetExportDataList(AppInfoiosEntity entity, string status) { StringBuilder commandText = new StringBuilder(); #region CommandText string pagecount = ""; if (entity.EndIndex != 0) { pagecount = " LIMIT " + entity.StartIndex + "," + entity.EndIndex; } #region bak #endregion List <MySqlParameter> paramsList = new List <MySqlParameter>(); commandText.AppendFormat(@" select a.AppID,a.AppName,a.ShowName,a.DevName,a.AppType,a.AppSize,a.AppPrice,a.AppVersion,a.Status,a.RecommFlagWord,a.ThumbPicUrl,a.IconPicUrl,a.AppPicUrl,a.AppUrl,AppDesc,a.RecommWord,a.CreateTime a.UpdateTime,a.AdsPicUrl,a.Remarks where (1=1 {0}) limit {1} ", GetStrWhere(entity, paramsList), pagecount); #endregion string sql = ""; //Type 1=已上架游戏 2=待审核游戏 3=游戏接入情况 sql = string.Format(@"select * from ({0})tt where tt.Status in ({1}) limit {2}", commandText.ToString(), status, pagecount); return(MySqlHelper.ExecuteDataset(this.ConnectionString, commandText.ToString(), null)); }
/// <summary> /// 更新应用信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Update(AppInfoiosEntity entity) { #region CommandText string commandText = @"UPDATE appinfo_ios SET AppName = @AppName, ShowName = @ShowName, DevName = @DevName, AppType =@AppType, AppSize =@AppSize, AppPrice =@AppPrice, AppVersion=@AppVersion, Status = @Status, RecommFlagWord=@RecommFlagWord, ThumbPicUrl=@ThumbPicUrl, IconPicUrl = @IconPicUrl, AppUrl = @AppUrl, AppPicUrl =@AppPicUrl, AppDesc = @AppDesc, Remarks = @Remarks, UpdateTime = @UpdateTime, RecommWord = @RecommWord, AdsPicUrl = @AdsPicUrl WHERE AppID = @AppID;"; #endregion return(ExecuteNonQuery(commandText, entity)); }
/// <summary> /// 修改更新时间 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool ChangeUpdateTime(AppInfoiosEntity entity) { string commandText = @"Update AppInfo_ios set UpdateTime =@UpdateTime, OpUpdateTime = @OpUpdateTime where AppID=@AppID;"; return(ExecuteNonQuery(commandText, entity)); }
private bool ExecuteNonQuery(string commandText, AppInfoiosEntity entity) { List <MySqlParameter> paramsList = GetMySqlParameters(entity); int result = MySqlHelper.ExecuteNonQuery(this.ConnectionString, commandText, paramsList.ToArray()); return(base.ExecuteStatus(result)); }
/// <summary> /// 新增应用信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Insert(AppInfoiosEntity entity) { #region CommandText string commandText = @" INSERT INTO AppInfo_ios ( AppID, AppName, ShowName, DevName, AppType, AppSize, AppPrice, AppVersion, Status, RecommFlagWord, ThumbPicUrl, IconPicUrl, AppPicUrl, AppUrl, AppDesc, RecommWord, CreateTime, UpdateTime, AdsPicUrl, Remarks ) VALUES ( @AppID, @AppName, @ShowName, @DevName, @AppType, @AppSize, @AppPrice, @AppVersion, @Status, @RecommFlagWord, @ThumbPicUrl, @IconPicUrl, @AppPicUrl, @AppUrl, @AppDesc, @RecommWord, @CreateTime, @UpdateTime, @AdsPicUrl, @Remarks ); SELECT LAST_INSERT_ID(); "; #endregion List <MySqlParameter> paramsList = this.GetMySqlParameters(entity); int result = MySqlHelper.ExecuteScalar(this.ConnectionString, commandText, paramsList.ToArray()).Convert <int>(); return(result); }
private string GetStrWhere(AppInfoiosEntity entity, List <MySqlParameter> paramsList) { StringBuilder str = new StringBuilder(); if (entity.Status == 0) { str.Append(" and a.Status = 1"); } if (entity.SearchType == "0") { if (!string.IsNullOrEmpty(entity.SearchKeys)) { str.AppendFormat("and a.ShowName like '%{0}%'", entity.SearchKeys);//按应用名称搜索 } else { str.ToString(); } } if (entity.SearchType == "1") { if (!string.IsNullOrEmpty(entity.SearchKeys)) { str.AppendFormat("and a.DevName like '%{0}%'", entity.SearchKeys);//按开发者名称搜索 } else { str.ToString(); } } if (entity.SearchType == "2") { if (!string.IsNullOrEmpty(entity.SearchKeys)) { str.AppendFormat("and a.AppID={0}", entity.SearchKeys);//按应用ID名称搜索 } else { str.ToString(); } } return(str.ToString()); }
/// <summary> /// 取得所有应用数据 /// </summary> /// <param name="entity"></param> /// <returns></returns> public DataSet GetExportAllDataList(AppInfoiosEntity entity) { #region SqlcommonText StringBuilder commandText = new StringBuilder(); List <MySqlParameter> paramsList = new List <MySqlParameter>(); commandText.AppendFormat(@" select a.AppID,a.AppName,a.ShowName,a.DevName,a.Status,a.IconUrl,a.AppUrl,AppDesc,a.RecommWord,a.CreateTime a.UpdateTime,a.AdsPicUrl,a.Remarks where (1=1 {0} and p.Status=1) ", GetStrWhere(entity, paramsList)); #endregion //分页 string pagecount = ""; if (entity.EndIndex != 0) { pagecount = " LIMIT " + entity.StartIndex + "," + entity.EndIndex; } return(MySqlHelper.ExecuteDataset(this.ConnectionString, commandText.ToString(), null)); }
/// <summary> /// 获取一条应用信息 /// </summary> /// <param name="ID"></param> /// <returns></returns> public AppInfoiosEntity GetSingle(int ID) { #region CommandText string commandText = @"SELECT AppID, AppName, ShowName, DevName, AppType, AppSize, AppPrice, AppVersion, Status, RecommFlagWord, IconPicUrl, ThumbPicUrl, AppPicUrl, AppUrl, AppDesc, RecommWord, CreateTime, UpdateTime, AdsPicUrl, Remarks FROM AppInfo_ios a WHERE a.AppID = @AppID LIMIT 0, 1;"; #endregion using (MySqlDataReader objReader = MySqlHelper.ExecuteReader(this.ConnectionString, commandText, new MySqlParameter("@AppID", ID))) { //return objReader.ReaderToModel<AppInfoiosEntity>() as AppInfoiosEntity; AppInfoiosEntity appInfoios = objReader.ReaderToModel <AppInfoiosEntity>() as AppInfoiosEntity; return(appInfoios); } }
private void BindData() { int totalCount = 0; AppInfoiosEntity entity = new AppInfoiosEntity() { SearchType = SearchType.SelectedValue, StartIndex = pagerList.StartRecordIndex - 1, EndIndex = pagerList.PageSize, Status = 1 }; entity.SearchKeys = this.SearchKeys.Value; List <AppInfoiosEntity> list = new AppInfoiosBLL().GetDataList(entity, ref totalCount); this.objRepeater.DataSource = list; this.objRepeater.DataBind(); pagerList.RecordCount = totalCount; pagerList.DataBind(); }
/// <summary> /// 获取应用信息 /// </summary> /// <param name="StartIndex"></param> /// <param name="EndIndex"></param> /// <param name="entity"></param> /// <returns></returns> private string GetStrWhereSeach(AppInfoiosEntity entity) { string str = ""; str += " where tt.Status not in (0)";//未被禁用 if (!string.IsNullOrEmpty(entity.SearchKeys)) { //应用名称 if (entity.SearchType == "0") { str += "and tt.ShowName like '%" + entity.SearchKeys + "%'"; } else if (entity.SearchType == "1") { str += "and tt.DevName like '%" + entity.SearchKeys + "%'"; } else if (entity.SearchType == "2") { str += " and tt.AppID=" + entity.SearchKeys; } } return(str); }
/// <summary> /// 获取分页应用信息 /// </summary> /// <param name="StartIndex"></param> /// <param name="EndIndex"></param> /// <param name="entity"></param> /// <returns></returns> public List <AppInfoiosEntity> GetDataListNew(AppInfoiosEntity entity) { StringBuilder commandText = new StringBuilder(); #region CommandText List <MySqlParameter> paramsList = new List <MySqlParameter>(); commandText.AppendFormat(@" select a.AppID,a.AppName,a.ShowName,a.DevName,a.AppType,a.AppSize,a.AppPrice,a.AppVersion,a.Status,a.RecommFlagWord,a.IconPicUrl,a.ThumbPicUrl,a.AppPicUrl,a.AppUrl,a.AppDesc,a.RecommWord,a.CreateTime,a.UpdateTime,a.AdsPicUrl,a.Remarks from appinfo_ios a where (1=1 ) {0} Order By a.AppID DESC LIMIT @StartIndex, @EndIndex ", GetStrWhere(entity, paramsList)); #endregion #region paramsList paramsList.Add(new MySqlParameter("@StartIndex", entity.StartIndex)); paramsList.Add(new MySqlParameter("@EndIndex", entity.EndIndex)); #endregion //nwbase_utils.TextLog.Default.Info(commandText.ToString()); using (MySqlDataReader reader = MySqlHelper.ExecuteReader(this.ConnectionString, commandText.ToString(), paramsList.ToArray())) { return(reader.ReaderToList <AppInfoiosEntity>() as List <AppInfoiosEntity>); } }
protected void btnSave_Click(object sender, EventArgs e) { try { AppInfoiosEntity appInfoios = new AppInfoiosEntity() { //应用ID AppID = this.AppID, //应用名称 AppName = this.AppName.Text.Trim(), //显示名称 ShowName = this.ShowName.Text.Trim(), //开发商名称 DevName = this.DevName.Text.Trim(), //应用类型 AppType = this.AppType.Text.Trim(), //应用大小 AppSize = this.AppSize.Text.Trim(), //应用价格 AppPrice = this.AppPrice.Text.Trim(), //应用版本 AppVersion = this.AppVersion.Text.Trim(), //应用标示语 RecommFlagWord = this.RecommFlagWord.Text.Trim(), //缩略图 ThumbPicUrl = this.ThumbPicUrl.Value, //应用连接Url地址 AppUrl = this.AppUrl.Text.Trim(), //应用推荐语 RecommWord = this.RecommWord.Text.Trim(), //描述语言 AppDesc = this.AppDesc.Text.Trim(), //Icon Url地址 IconPicUrl = this.Request <string>("IconPicUrl", string.Empty), //IconUrl = this.IconUrl.Value, //广告Urls //AdsPicUrl = this.AdsUrl.Text.Trim(), AdsPicUrl = this.AdsPicUrl.Value, //推荐语 Remarks = this.Remarks.Text.Trim(), //应用状态 Status = this.Status.SelectedValue.Convert <int>() }; #region 判断数据有效性 if (string.IsNullOrEmpty(appInfoios.ShowName)) { this.Alert("显示名称不能为空"); return; } else if (string.IsNullOrEmpty(appInfoios.AppName)) { this.Alert("安装包包名不能为空"); return; } else if (string.IsNullOrEmpty(appInfoios.IconPicUrl)) { this.Alert("Icon不能为空"); return; } bool result1 = false; //判断些应用信息是否已经存在 result1 = new AppInfoiosBLL().IsExistAppInfo(this.AppName.Text.Trim()); if (result1) { this.Alert("应用已经存在"); return; } //iosApp信息cms后台管理 string[] appPicUrl = this.Request.Params["AppPicUrl"].Split(','); string str_PicUrl = ""; //添加应用截图,URL之间用英文逗号分隔 for (int i = 0; i < appPicUrl.Length; i++) { str_PicUrl = str_PicUrl == "" ? appPicUrl[i] : (str_PicUrl + ',' + appPicUrl[i]); } appInfoios.AppPicUrl = str_PicUrl; this.X1 = Math.Round(this.Request.Params["x1"].Convert <double>(0)); this.X2 = Math.Round(this.Request.Params["x2"].Convert <double>(0)); this.Y1 = Math.Round(this.Request.Params["y1"].Convert <double>(0)); this.Y2 = Math.Round(this.Request.Params["y2"].Convert <double>(0)); this.Width = Math.Round(this.Request.Params["w"].Convert <double>(0)); this.Height = Math.Round(this.Request.Params["h"].Convert <double>(0)); #endregion #region 处理缩略图 if (!string.IsNullOrEmpty(appInfoios.IconPicUrl)) { if (this.Width != 0 && this.Height != 0) { //裁剪方式 string croptype = this.Request <string>("cropType", string.Empty); Bitmap bitSource = ImageHelper.GetBitmapFromUrl(appInfoios.IconPicUrl); if (bitSource == null) { this.Alert("远程图片解析失败,请刷新后再试"); return; } int rX = Convert.ToInt32(Math.Round(this.X1, MidpointRounding.AwayFromZero)); int rY = Convert.ToInt32(Math.Round(this.Y1, MidpointRounding.AwayFromZero)); int rW = Convert.ToInt32(Math.Round(this.Width, MidpointRounding.AwayFromZero)); int rH = Convert.ToInt32(Math.Round(this.Height, MidpointRounding.AwayFromZero)); bitSource = ImageHelper.KiCut(bitSource, rX, rY, rW, rH); if (croptype == "hengping") { bitSource = ImageHelper.ImageCompress(bitSource, 260, 195); } else { bitSource = ImageHelper.ImageCompress(bitSource, 195, 260); } UploadFile up = new UploadFile(); byte[] imageBytes = BitmapToBytes(bitSource); //StartTransfer中的AppID在前端页面中上传控件定义 string token = up.StartTransfer(2, 11, appInfoios.IconPicUrl.Substring(appInfoios.IconPicUrl.LastIndexOf("."), 4), 1, imageBytes.Length, string.Empty); string resultString = up.Transfer(token, imageBytes, 1); appInfoios.IconPicUrl = resultString.Split(',')[1]; //up.GenerateThumb(appInfo.ThumbPicUrl, 0); up.GenerateThumb(token); bitSource.Dispose(); } } #endregion if (string.IsNullOrEmpty(appInfoios.AppName)) { this.Alert("资料不完整,请完善后再试"); return; } //写入数据库 int result2 = new AppInfoiosBLL().Insert(appInfoios); if (result2 != 0) { if (this.AppClass == "23") { OperateRecordEntity info = new OperateRecordEntity() { ElemId = result2, reason = "", Status = 1, OperateFlag = "1", OperateType = "2", OperateExplain = "新增IOS游戏", SourcePage = 1, OperateContent = appInfoios.ShowName, UserName = GetUserName(), }; new OperateRecordBLL().Insert(info); } this.Response.Redirect(string.Format("IosAppInfoList.aspx?AppID={0}&ShowName={1}", this.AppID, appInfoios.ShowName)); } else { this.Alert("新增失败"); } } catch (Exception ex) { nwbase_utils.TextLog.Default.Error(ex.Message); throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { CurrentEntity = new AppInfoiosBLL().GetSingle(this.AppID); try { AppInfoiosEntity appInfoios = new AppInfoiosEntity(); appInfoios.AppID = this.AppID; appInfoios.AppName = this.AppName.Text.Trim(); appInfoios.RecommFlagWord = this.RecommFlagWord.Text.Trim(); appInfoios.AppType = this.AppType.Text.Trim(); appInfoios.AppSize = this.AppSize.Text.Trim(); appInfoios.AppPrice = this.AppPrice.Text.Trim(); appInfoios.AppVersion = this.AppVersion.Text.Trim(); appInfoios.ThumbPicUrl = this.ThumbPicUrl.Value; appInfoios.ShowName = this.ShowName.Text.Trim(); appInfoios.DevName = this.DevName.Text.Trim(); appInfoios.RecommWord = this.RecommWord.Text.Trim(); appInfoios.IconPicUrl = this.IconUrl.Value; appInfoios.AppDesc = this.AppDesc.Text.Trim(); appInfoios.Remarks = this.Remarks.Text.Trim(); appInfoios.Status = this.Status.SelectedValue.Convert <int>(); appInfoios.AppUrl = this.AppUrl.Text.Trim(); appInfoios.AdsPicUrl = this.AdsPicUrl.Value; appInfoios.AppPicUrl = (this.AppPicUrl == "") ? CurrentEntity.AppPicUrl : this.AppPicUrl; this.X1 = Math.Round(this.Request.Params["x1"].Convert <double>(0)); this.X2 = Math.Round(this.Request.Params["x2"].Convert <double>(0)); this.Y1 = Math.Round(this.Request.Params["y1"].Convert <double>(0)); this.Y2 = Math.Round(this.Request.Params["y2"].Convert <double>(0)); this.Width = Math.Round(this.Request.Params["w"].Convert <double>(0)); this.Height = Math.Round(this.Request.Params["h"].Convert <double>(0)); #region 处理缩略图 if (!string.IsNullOrEmpty(appInfoios.IconPicUrl)) { if (this.Width != 0 && this.Height != 0) { //裁剪方式 string croptype = this.Request <string>("cropType", string.Empty); Bitmap bitSource = ImageHelper.GetBitmapFromUrl(appInfoios.IconPicUrl); if (bitSource == null) { this.Alert("远程图片解析失败,请刷新后再试"); return; } int rX = Convert.ToInt32(Math.Round(this.X1, MidpointRounding.AwayFromZero)); int rY = Convert.ToInt32(Math.Round(this.Y1, MidpointRounding.AwayFromZero)); int rW = Convert.ToInt32(Math.Round(this.Width, MidpointRounding.AwayFromZero)); int rH = Convert.ToInt32(Math.Round(this.Height, MidpointRounding.AwayFromZero)); bitSource = ImageHelper.KiCut(bitSource, rX, rY, rW, rH); if (croptype == "hengping") { bitSource = ImageHelper.ImageCompress(bitSource, 260, 195); } else { bitSource = ImageHelper.ImageCompress(bitSource, 195, 260); } UploadFile up = new UploadFile(); byte[] imageBytes = BitmapToBytes(bitSource); //StartTransfer中的AppID和CID在前端页面中上传控件定义 string token = up.StartTransfer(2, 11, appInfoios.IconPicUrl.Substring(appInfoios.IconPicUrl.LastIndexOf("."), 4), 1, imageBytes.Length, string.Empty); string resultString = up.Transfer(token, imageBytes, 1); appInfoios.IconPicUrl = resultString.Split(',')[1]; //up.GenerateThumb(appInfo.ThumbPicUrl, 0); up.GenerateThumb(token); bitSource.Dispose(); } } #endregion if (string.IsNullOrEmpty(appInfoios.AppName)) { this.Alert("资料不完整,请完善后再试"); return; } //写入数据库 bool result = new AppInfoiosBLL().Update(appInfoios); //判断是否修改成功 if (result) { OperateRecordEntity info = new OperateRecordEntity() { ElemId = appInfoios.AppID, reason = "", Status = 1, OperateFlag = "2", OperateType = "2", OperateExplain = "修改IOS游戏信息", SourcePage = 1, OperateContent = appInfoios.ShowName, UserName = GetUserName(), }; new OperateRecordBLL().Insert(info); this.Response.Redirect(string.Format("IosAppInfoList.aspx?AppID={0}&ShowName={1}", this.AppID, appInfoios.ShowName)); this.Alert("操作成功", string.Format("IosAppInfoEdit.aspx")); } else { this.Alert("操作失败"); } } catch (Exception ex) { nwbase_utils.TextLog.Default.Error(ex.Message); throw ex; } }
/// <summary> /// 修改更新时间 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool ChangeUpdateTime(AppInfoiosEntity entity) { return(new AppInfoiosDAL().ChangeUpdateTime(entity)); }
/// <summary> /// 获取应用信息 /// </summary> /// <param name="StartIndex"></param> /// <param name="EndIndex"></param> /// <param name="entity"></param> /// <returns></returns> public List <AppInfoiosEntity> GetDataListNew(AppInfoiosEntity entity, ref int totalCount) { totalCount = new AppInfoiosDAL().GetTotalCount(entity); return(new AppInfoiosDAL().GetDataListNew(entity)); }
/// <summary> /// 更新应用信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Update(AppInfoiosEntity entity) { return(new AppInfoiosDAL().Update(entity)); }
/// <summary> /// 新增应用信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Insert(AppInfoiosEntity entity) { return(new AppInfoiosDAL().Insert(entity)); }
public DataSet GetExportDataList(AppInfoiosEntity entity, string status) { return(new AppInfoiosDAL().GetExportDataList(entity, status)); }
public bool DeleteByID(AppInfoiosEntity entity) { return(new AppInfoiosDAL().DeleteByID(entity)); }
private void Condition(StringBuilder commandText, List <MySqlParameter> paramsList, AppInfoiosEntity entity) { if (entity.Status == 0) { commandText.Append("and a.Status = 1"); } }
public bool DeleteByID(AppInfoiosEntity entity) { string commandText = @"Update Appinfo set UpdateTime =@UpdateTime,Status=@Status where AppID=@AppID;"; return(ExecuteNonQuery(commandText, entity)); }