protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["action"] == "del") { int id = Convert.ToInt32(Request.QueryString["id"]); if (id > 0) { AppInfoEntity info = new AppInfoEntity() { AppID = id, UpdateTime = DateTime.Now, Status = 98 }; new AppInfoBLL().DeleteByID(info); BindGridView(); } } else { BindGridView(); } } }
public DataTable GetGroupInfo(int GroupID) { DataTable dt = new DataTable(); DataSet dataset = new GroupElemsBLL().QueryDataSetByGroupID(GroupID); DataTable datatable = dataset.Tables[0]; int typeId = new GroupInfoBll().QueryGroupInfoByGroupID(GroupID).GroupTypeID; AppInfoEntity entity = new AppInfoEntity() { AppClass = 12, AppType = typeId, StartIndex = 0, OrderType = "DownTimes", EndIndex = 500, Status = 1, }; if (GroupID == 93) { entity.AppType = 0; } else if (GroupID == 94) { entity.AppType = 0; entity.OrderType = "CreateTime"; } string status = "1"; DataSet ds = new AppInfoBLL().GetExportDataList2(entity, status, "70"); dt = ds.Tables[0]; return(dt); }
public DataSet GetExportDataList2(AppInfoEntity entity, string status, string channel) { StringBuilder commandText = new StringBuilder(); #region CommandText #region bak #endregion List <MySqlParameter> paramsList = new List <MySqlParameter>(); commandText.AppendFormat(@" select r.AppTypeName,r.AppClass , a.AppID,a.CPID,a.DevName,a.DownTimes,a.AppName,a.ShowName,a.CoopType,a.IsNetGame,a.Architecture,a.AppType,a.CreateTime,a.UpdateTime,a.Status,a.ChannelAdaptation,a.PackCount,a.MainPackID,a.MainIconUrl,a.MainVerName, a.PackName,p.permission from AppInfo a inner join packinfo p on p.PackID=a.MainPackID left join AppTypes r on a.AppType = r.AppType where (1=1 {0} and p.Status=1) ", GetStrWhere(entity, paramsList)); #endregion string pagecount = ""; if (entity.EndIndex != 0) { pagecount = " LIMIT " + entity.StartIndex + "," + entity.EndIndex; } #region sql string sql = ""; //Type 1=已上架游戏 2=待审核游戏 3=游戏接入情况 sql = string.Format(@"select tt.ShowName as '游戏名',tt.PackName as '包名',tt.MainVerName as '版本',tt.AppTypeName as '游戏分类',tt.CoopType as '合作类型',tt.DevName as '开发者',tt.Status as '状态',tt.permission as '调用权限',tt.AppID as 'ID' from ({0})tt where tt.ChannelAdaptation like '%{3}%' and tt.Status in ({2}) Order By {1} desc {4}", commandText.ToString(), entity.OrderType, status, channel, pagecount); //nwbase_utils.TextLog.Default.Info(sql); #endregion return(MySqlHelper.ExecuteDataset(this.ConnectionString, sql, null)); }
/// <summary> /// /// </summary> /// <param name="entity"></param> /// <returns></returns> public string GetWhere(AppInfoEntity entity) { string str = ""; if (!string.IsNullOrEmpty(entity.SearchKeys)) { //应用名称 if (entity.SearchType == "0") { str = " and a.ShowName like '%" + entity.SearchKeys + "%'"; } else if (entity.SearchType == "1") { str = " and a.DevName like '%" + entity.SearchKeys + "%'"; } else if (entity.SearchType == "2") { str = " and a.AppID=" + entity.SearchKeys; } else if (entity.SearchType == "3") { str = " and a.PackName='" + entity.SearchKeys + "'"; } } return(str); }
/// <summary> /// 获取总记录数 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int GetTotalCount(AppInfoEntity entity) { StringBuilder commandText = new StringBuilder(); #region CommandText #endregion #region CommandText List <MySqlParameter> paramsList = new List <MySqlParameter>(); commandText.AppendFormat(@" select t1.* from ( select a.*,r.AppTypeName,r.AppClass from AppInfo a,AppTypes r where a.AppType=r.AppType {0} )t1 left join ( select a.appid from AppInfo a,AppTypes r where a.AppType=r.AppType )t2 on t1.appid=t2.appid ", GetStrWhere(entity, paramsList)); #endregion string sql = string.Format(@"select count(*) from ({0})tt {1} Order By {2} desc", commandText.ToString(), GetStrWhereSeach(entity), entity.OrderType); //nwbase_utils.TextLog.Default.Info(sql); return(MySqlHelper.ExecuteScalar(this.ConnectionString, sql).Convert <int>()); }
/// <summary> /// 获取应用信息 /// </summary> /// <param name="StartIndex"></param> /// <param name="EndIndex"></param> /// <param name="entity"></param> /// <returns></returns> public List <AppInfoEntity> GetDataListNew(AppInfoEntity entity, string status, string channel) { StringBuilder commandText = new StringBuilder(); #region CommandText #region bak #endregion List <MySqlParameter> paramsList = new List <MySqlParameter>(); commandText.AppendFormat(@" select r.AppTypeName,r.AppClass , a.AppID,a.CPID,a.DevName,a.DownTimes,a.AppName,a.ShowName,a.DownTimesReal,a.CoopType,a.IsNetGame,a.Architecture,a.AppType,a.CreateTime,a.UpdateTime,a.Status,a.ChannelAdaptation,a.PackCount,a.MainPackID,a.MainIconUrl,a.MainVerName, a.PackName,p.permission from AppInfo a left join packinfo p on p.PackID=a.MainPackID left join AppTypes r on a.AppType = r.AppType where (1=1 {0}) {4} and a.Status in ({3}) {2} Order By {1} desc LIMIT @StartIndex, @EndIndex ", GetStrWhere(entity, paramsList), entity.OrderType, GetWhere(entity), status, GetChannelAdaptation(channel)); #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 <AppInfoEntity>() as List <AppInfoEntity>); } }
public async Task <int> UpdateInfo(string id, AppInfo value) { AppEntity dbEntityApp = await Repo.GetById(id).ConfigureAwait(false); if (dbEntityApp == null) { throw new NotFoundApiException($"{GetType().Name} id '{id}' not found"); } AppInfoEntity dbEntityInfo = await Repo.GetContext .AppInfos .FindAsync(id).ConfigureAwait(false); ; AppInfoEntity info = Mapper.Map(value, dbEntityInfo); if (dbEntityInfo == null) { info.AppId = id; await Repo.GetContext.AppInfos.AddAsync(info).ConfigureAwait(false); } else { Mapper.Map(value, dbEntityInfo); } return(await Repo.GetContext.SaveChangesAsync().ConfigureAwait(false)); }
private string GetStrWhere(AppInfoEntity entity, List <MySqlParameter> paramsList) { StringBuilder str = new StringBuilder(); if (entity.AppClass > 0) { str.AppendFormat(" and (r.AppClass = {0} or r.AppClass is null)", entity.AppClass); } if (entity.Status == 0) { str.Append(" and a.Status = 1"); } if (entity.TypeID != "0" && !string.IsNullOrEmpty(entity.TypeID)) { str.AppendFormat(" and a.AppType = {0}", entity.TypeID); } if (entity.AppType > 0 && !string.IsNullOrEmpty(entity.AppType.ToString())) { str.AppendFormat(" and a.AppType = {0}", entity.AppType); } if (entity.IsNetGame != 0) { str.AppendFormat(" and a.IsNetGame = {0}", entity.IsNetGame); } paramsList.Add(new MySqlParameter("@AppClass", entity.AppClass)); return(str.ToString()); }
/// <summary> /// 获取应用信息 /// </summary> /// <param name="StartIndex"></param> /// <param name="EndIndex"></param> /// <param name="entity"></param> /// <returns></returns> private string GetStrWhereSeach(AppInfoEntity entity) { string str = ""; str += " where tt.Status not in (98,99)"; if (!string.IsNullOrEmpty(entity.SearchKeys)) { //应用名称 if (entity.SearchType == "0") { str += "and tt.ShowName like '%" + entity.SearchKeys + "%'"; } else if (entity.SearchType == "1") { str += "and tt.CPID in ({" + entity.SearchKeys + "}) "; } else if (entity.SearchType == "2") { str += " and tt.AppID=" + entity.SearchKeys; } } if (entity.AppType > 0) { str += " and tt.AppType=" + entity.AppType; } return(str); }
private void BindData() { int totalCount = 0; pagerList.PageSize = 20; AppInfoEntity entity = new AppInfoEntity(); entity.SearchKeys = this.Keyword_2.Value.Trim(); entity.StartIndex = pagerList.StartRecordIndex - 1; if (pagerList.StartRecordIndex == 1) { entity.EndIndex = pagerList.PageSize; } else { entity.EndIndex = pagerList.EndRecordIndex; } List <AppInfoEntity> list = new AppInfoBLL().GetUAppInfoList(entity, ref totalCount); this.objRepeater.DataSource = list; this.objRepeater.DataBind(); pagerList.RecordCount = totalCount; pagerList.DataBind(); }
/// <summary> /// 从统计数据库中获取联运游戏列表 /// </summary> /// <param name="entity"></param> /// <returns></returns> public List <AppInfoEntity> GetUAppInfoList(AppInfoEntity entity) { string sqlConnStr = Tools.GetConnStrConfig("ActionStateConnectionString"); List <SqlParameter> paramsList = new List <SqlParameter>(); paramsList.Add(new SqlParameter("@StartIndex", entity.StartIndex)); paramsList.Add(new SqlParameter("@EndIndex", entity.EndIndex)); string commandText = @"select * FROM ( select AppID,AppName,ROW_NUMBER() OVER(ORDER by AppID) as rowNumber from UAppInfo )t where t.rowNumber >@StartIndex AND t.rowNumber <=@EndIndex "; if (!string.IsNullOrEmpty(entity.SearchKeys)) { commandText += @" and t.AppName like @SearchKeys "; paramsList.Add(new SqlParameter("@SearchKeys", string.Format("%{0}%", entity.SearchKeys))); } using (SqlDataReader objReader = SqlHelper.ExecuteReader(sqlConnStr, CommandType.Text, commandText, paramsList.ToArray())) { return(objReader.ReaderToList <AppInfoEntity>() as List <AppInfoEntity>); } }
private void BindData() { int totalCount = 0; AppInfoEntity entity = new AppInfoEntity() { SearchType = SearchType.SelectedValue, SearchKeys = this.Keyword_2.Value.Trim(), AppClass = 11, TypeID = AppType.SelectedValue, OrderType = OrderType.SelectedValue, StartIndex = pagerList.StartRecordIndex - 1, EndIndex = pagerList.PageSize, Status = 0 }; if (SearchType.SelectedValue == "1") { entity.SearchKeys = new B_DevBLL().GetDevIDByName(this.Keyword_2.Value); } dic_DevList = new B_DevBLL().GetDevListDic(); dic_DevList[0] = ""; List <AppInfoEntity> list = new AppInfoBLL().GetDataList(entity, ref totalCount, SchemeID); this.objRepeater.DataSource = list; this.objRepeater.DataBind(); pagerList.RecordCount = totalCount; pagerList.DataBind(); }
private void BindTag(AppInfoEntity CurrentEntity) { int apptag = CurrentEntity.AppTag; if (apptag == 1) { chbIsSafe.Items[0].Selected = true; } else if (apptag == 3) { chbIsSafe.Items[0].Selected = true; chbIsSafe.Items[1].Selected = true; } else if (apptag == 5) { chbIsSafe.Items[0].Selected = true; chbIsSafe.Items[2].Selected = true; } else if (apptag == 6) { chbIsSafe.Items[1].Selected = true; chbIsSafe.Items[2].Selected = true; } else if (apptag == 7) { chbIsSafe.Items[0].Selected = true; chbIsSafe.Items[1].Selected = true; chbIsSafe.Items[2].Selected = true; } }
public void Export(int actype) { try { AppInfoEntity entity = new AppInfoEntity() { SearchType = SearchType.SelectedValue, SearchKeys = this.Keyword_2.Text.Trim(), AppClass = 12, //AppType = AppType.SelectedValue.Convert<int>(0), OrderType = OrderType.SelectedValue, StartIndex = 0, EndIndex = 0, Status = actype, }; if (SearchType.SelectedValue == "1") { entity.SearchKeys = new B_DevBLL().GetDevIDByName(this.Keyword_2.Text); } string status = ""; switch (actype) { case 1: status = "1"; break; case 2: status = "6"; break; case 3: status = "4,5,6,7"; break; case 4: status = "2"; break; case 5: status = "7"; break; default: break; } dataset = new AppInfoBLL().GetExportDataList(entity, status, ",70,"); datatable = dataset.Tables[0]; string fileName = string.Format("GameInfo_{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss")); string path = Server.MapPath(ServerMapPath() + fileName); WriteExcel2(datatable, path, fileName); DownloadFile(path); } catch (Exception) { throw; } }
/// <summary> /// 修改更新时间 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool ChangeUpdateTime(AppInfoEntity entity) { string commandText = @"Update AppInfo set UpdateTime =@UpdateTime, OpUpdateTime = @OpUpdateTime where AppID=@AppID;"; return(ExecuteNonQuery(commandText, entity)); }
private bool ExecuteNonQuery(string commandText, AppInfoEntity entity) { List <MySqlParameter> paramsList = GetMySqlParameters(entity); int result = MySqlHelper.ExecuteNonQuery(this.ConnectionString, commandText, paramsList.ToArray()); return(base.ExecuteStatus(result)); }
private AppInfoDTO TODTO(AppInfoEntity entity) { AppInfoDTO dto = new AppInfoDTO(); dto.Id = entity.Id; dto.AppKey = entity.AppKey; dto.AppSecret = entity.AppSecret; return(dto); }
/// <summary> /// </summary> /// <param name="elemID"></param> /// <returns></returns> public bool DelGroupElems(int elemID) { AppInfoEntity entity = new AppInfoEntity() { AppID = elemID }; string commandText = @"update GroupElems set Status = 2 WHERE elemID = @AppID and Status=1 "; return(ExecuteNonQuery(commandText, entity)); }
/// <summary> /// 更新应用信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool UpdatePackCount(AppInfoEntity entity) { #region CommandText string commandText = @"UPDATE AppInfo SET PackCount = @PackCount WHERE AppID = @AppID ;"; #endregion return(ExecuteNonQuery(commandText, entity)); }
private List <MySqlParameter> GetMySqlParameters(AppInfoEntity entity) { List <MySqlParameter> paramsList = new List <MySqlParameter>(); paramsList.Add(new MySqlParameter("@AppID", entity.AppID)); paramsList.Add(new MySqlParameter("@CPID", entity.CPID)); paramsList.Add(new MySqlParameter("@CoopType", entity.CoopType)); paramsList.Add(new MySqlParameter("@IssueType", entity.IssueType)); paramsList.Add(new MySqlParameter("@ChannelNos", entity.ChannelNos)); paramsList.Add(new MySqlParameter("@DevName", entity.DevName)); paramsList.Add(new MySqlParameter("@PackName", entity.PackName)); paramsList.Add(new MySqlParameter("@PackSign", entity.PackSign)); paramsList.Add(new MySqlParameter("@AppName", entity.AppName)); paramsList.Add(new MySqlParameter("@ShowName", entity.ShowName)); paramsList.Add(new MySqlParameter("@ForDeviceType", entity.ForDeviceType)); paramsList.Add(new MySqlParameter("@IsNetGame", entity.IsNetGame)); paramsList.Add(new MySqlParameter("@AppType", entity.AppType)); paramsList.Add(new MySqlParameter("@AppTag", entity.AppTag)); paramsList.Add(new MySqlParameter("@EvilLevel", entity.EvilLevel)); paramsList.Add(new MySqlParameter("@DownTimes", entity.DownTimes)); paramsList.Add(new MySqlParameter("@DownTimesReal", entity.DownTimesReal)); paramsList.Add(new MySqlParameter("@CommentTimes", entity.CommentTimes)); paramsList.Add(new MySqlParameter("@SearchKeys", entity.SearchKeys)); paramsList.Add(new MySqlParameter("@AppDesc", entity.AppDesc)); paramsList.Add(new MySqlParameter("@Remarks", entity.Remarks)); 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("@DataStatus", entity.DataStatus)); paramsList.Add(new MySqlParameter("@RecommTag", entity.RecommTag)); paramsList.Add(new MySqlParameter("@RecommLevel", entity.RecommLevel)); paramsList.Add(new MySqlParameter("@MainPackID", entity.MainPackID)); paramsList.Add(new MySqlParameter("@RecommWord", entity.RecommWord)); paramsList.Add(new MySqlParameter("@MainIconUrl", entity.MainIconUrl)); paramsList.Add(new MySqlParameter("@MainPackSize", entity.MainPackSize)); paramsList.Add(new MySqlParameter("@MainVerCode", entity.MainVerCode)); paramsList.Add(new MySqlParameter("@MainVerName", entity.MainVerName)); paramsList.Add(new MySqlParameter("@OpCreateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); paramsList.Add(new MySqlParameter("@OpUpdateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); paramsList.Add(new MySqlParameter("@Status", entity.Status)); paramsList.Add(new MySqlParameter("@StartIndex", entity.StartIndex)); paramsList.Add(new MySqlParameter("@EndIndex", entity.EndIndex)); paramsList.Add(new MySqlParameter("@ChannelAdaptation", entity.ChannelAdaptation)); paramsList.Add(new MySqlParameter("@PackCount", entity.PackCount)); paramsList.Add(new MySqlParameter("@Architecture", entity.Architecture)); return(paramsList); }
/// <summary> /// 上传安装包后更新应用信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool UpDatePackInfo(AppInfoEntity entity) { string commandText = @"Update AppInfo set MainPackID=@MainPackID, MainIconUrl = @MainIconUrl, CoopType = @CoopType, PackName=@PackName, MainVerCode=@MainVerCode, MainPackSize=@MainPackSize, MainVerName=@MainVerName, PackSign = @PackSign, OpUpdateTime = @OpUpdateTime, DataStatus = @DataStatus where AppID=@AppID;"; return(ExecuteNonQuery(commandText, entity)); }
private void BindArchitecture(AppInfoEntity CurrentEntity) { int Architecture = CurrentEntity.Architecture; if (Architecture == 1) { cbArchitecture.Items[0].Selected = true; } else if (Architecture == 2) { cbArchitecture.Items[1].Selected = true; } else if (Architecture == 3) { cbArchitecture.Items[0].Selected = true; cbArchitecture.Items[1].Selected = true; } }
/// <summary> /// 获取总记录数 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int GetTotalCountNew(AppInfoEntity entity, string status, string channel) { #region CommandText StringBuilder commandText = new StringBuilder(); List <MySqlParameter> paramsList = new List <MySqlParameter>(); commandText.AppendFormat(@" select count(a.AppID) from AppInfo a left join packinfo p on p.PackID=a.MainPackID left join AppTypes r on a.AppType = r.AppType where (1=1 {0} ) {3} and a.Status in ({2}) {1} ", GetStrWhere(entity, paramsList), GetWhere(entity), status, GetChannelAdaptation(channel)); #endregion //nwbase_utils.TextLog.Default.Info(commandText.ToString()); return(MySqlHelper.ExecuteScalar(this.ConnectionString, commandText.ToString()).Convert <int>()); }
protected string AppType(object appId) { AppInfoEntity info = appInfoBll.GetSingle((int)appId); int appClass = info.AppClass; if (appClass == 1 || appClass == 11) { return("应用"); } else if (appClass == 2 || appClass == 12) { return("游戏"); } else { return(""); } }
/// <summary> /// 获取应用信息 /// </summary> /// <param name="StartIndex"></param> /// <param name="EndIndex"></param> /// <param name="entity"></param> /// <returns></returns> public List <AppInfoEntity> GetDataList(AppInfoEntity entity, ref int totalCount, int SchemeID = 0) { string channel = ""; if (SchemeID == 104) { channel = ",70,"; } else if (SchemeID == 101) { channel = ",20,"; } string status = "1,2"; if (SchemeID == 0) { status = "1,2,3,4,5,6,7"; } totalCount = new AppInfoDAL().GetTotalCountNew(entity, status, channel); return(new AppInfoDAL().GetDataListNew(entity, status, channel)); }
public int GetUAppInfoCount(AppInfoEntity entity) { string sqlConnStr = Tools.GetConnStrConfig("ActionStateConnectionString"); List <SqlParameter> paramsList = new List <SqlParameter>(); string commandText = @"select count(0) from UAppInfo "; if (!string.IsNullOrEmpty(entity.SearchKeys)) { commandText += @" Where AppName like @SearchKeys "; paramsList.Add(new SqlParameter("@SearchKeys", string.Format("%{0}%", entity.SearchKeys))); } var result = SqlHelper.ExecuteScalar(sqlConnStr, CommandType.Text, commandText, paramsList.ToArray()); return(result.Convert <int>(0)); }
private void BindData() { int totalCount = 0; AppInfoEntity entity = new AppInfoEntity() { SearchType = SearchType.SelectedValue, SearchKeys = this.Keyword_2.Value.Trim(), IsNetGame = IsNetGame.SelectedValue.Convert <int>(0), AppClass = 12, AppType = AppType.SelectedValue.Convert <int>(0), OrderType = OrderType.SelectedValue, StartIndex = pagerList.StartRecordIndex - 1, EndIndex = pagerList.PageSize, Status = 1 }; if (SearchType.SelectedValue == "1") { entity.SearchKeys = new B_DevBLL().GetDevIDByName(this.Keyword_2.Value); } dic_DevList = new B_DevBLL().GetDevListDic(); dic_DevList[0] = ""; List <AppInfoEntity> list = new AppInfoBLL().GetDataList(entity, ref totalCount); if (MaxAppID > 0) { list = list.Where(a => a.AppID < MaxAppID).ToList(); } this.objRepeater.DataSource = list; this.objRepeater.DataBind(); pagerList.RecordCount = totalCount; pagerList.DataBind(); }
/// <summary> /// 更新应用信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Update(AppInfoEntity entity) { #region CommandText string commandText = @"UPDATE AppInfo SET AppID = @AppID, CPID = @CPID, IssueType=@IssueType, ChannelNos=@ChannelNos, ChannelAdaptation=@ChannelAdaptation, DevName = @DevName, PackSign = @PackSign, AppName = @AppName, ShowName = @ShowName, ForDeviceType = @ForDeviceType, IsNetGame = @IsNetGame, Architecture=@Architecture, AppType = @AppType, AppTag = @AppTag, EvilLevel = @EvilLevel, DownTimes = @DownTimes, DownTimesReal = @DownTimesReal, CommentTimes = @CommentTimes, SearchKeys = @SearchKeys, AppDesc = @AppDesc, Remarks = @Remarks, UpdateTime = @UpdateTime, RecommTag = @RecommTag, RecommLevel = @RecommLevel, RecommWord = @RecommWord, Status = @Status WHERE AppID = @AppID ;"; #endregion return(ExecuteNonQuery(commandText, entity)); }
public async Task <long> AddNewAsync(AddAppInfoDTO dot) { AppInfoEntity entity = new AppInfoEntity(); entity.AppKey = dot.AppKey; entity.AppSecret = dot.AppSecret; entity.Email = dot.Email; using (OtherContext ctx = new OtherContext()) { BaseService <AppInfoEntity> bs = new BaseService <AppInfoEntity>(ctx); var appinfo = await bs.GetAll().SingleOrDefaultAsync(e => e.Email == dot.Email); if (appinfo != null) { throw new Exception("邮箱已存在"); } await ctx.AppInfos.AddAsync(entity); await ctx.SaveChangesAsync(); return(entity.Id); } }
protected void btnSave_Click(object sender, EventArgs e) { AppInfoEntity appInfo = new AppInfoEntity(); appInfo.AppID = this.AppID; //appInfo.UAppID = this.hidUAppID.Value.Convert<int>(0); appInfo.MainPackID = 0; appInfo.AppName = this.AppName.Text.Trim(); appInfo.ShowName = this.ShowName.Text.Trim(); appInfo.Architecture = GetArchitecture(); appInfo.ForDeviceType = this.ForDeviceTypeList.SelectedValue.Convert <int>(0); appInfo.PackName = this.MainPackName.Value; appInfo.PackSign = string.Empty; appInfo.CPID = this.DevID.Value.Convert <int>(0); appInfo.IssueType = Convert.ToInt32(drpIssueType.SelectedItem.Value); appInfo.ChannelNos = GetChannel(); appInfo.ChannelAdaptation = GetChannel2(); appInfo.DevName = this.CPName.Text.Trim(); appInfo.AppClass = this.AppClass.Convert <int>(11); appInfo.IsNetGame = this.IsNetGame.SelectedValue.Convert <int>(0); appInfo.EvilLevel = this.EvilLevel.SelectedValue.Convert <int>(0); appInfo.RecommLevel = this.RecommLevel.SelectedValue.Convert <int>(0); appInfo.RecommWord = this.RecommWord.Text.Trim(); appInfo.ThumbPicUrl = this.ThumbPicUrl.Value; appInfo.AppDesc = this.AppDesc.Text.Trim(); appInfo.SearchKeys = this.SearchKeys.Text.Trim(); appInfo.DownTimes = this.DownTimes.Text.Trim().Convert <int>(); appInfo.Remarks = this.Remarks.Text.Trim(); appInfo.Status = this.Status.SelectedValue.Convert <int>(); appInfo.MainVerName = string.Empty; appInfo.MainVerCode = 0; appInfo.MainSignCode = string.Empty; appInfo.MainIconUrl = string.Empty; appInfo.RecommTag = GetRecommFlag(); appInfo.AppTag = GetTag(); 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)); if (string.IsNullOrEmpty(this.AppType.SelectedValue)) { this.Alert("请选择分类信息"); return; } //应用类型 appInfo.AppType = this.AppType.SelectedValue.Convert <int>(0); #region 处理缩略图 if (this.OldThumbPicUrl.Value != this.ThumbPicUrl.Value) { if (!string.IsNullOrEmpty(appInfo.ThumbPicUrl)) { if (this.Width != 0 && this.Height != 0) { //裁剪方式 string croptype = this.Request <string>("cropType", string.Empty); Bitmap bitSource = ImageHelper.GetBitmapFromUrl(appInfo.ThumbPicUrl); 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, appInfo.ThumbPicUrl.Substring(appInfo.ThumbPicUrl.LastIndexOf("."), 4), 1, imageBytes.Length, string.Empty); string resultString = up.Transfer(token, imageBytes, 1); appInfo.ThumbPicUrl = resultString.Split(',')[1]; //up.GenerateThumb(appInfo.ThumbPicUrl, 0); up.GenerateThumb(token); bitSource.Dispose(); } } } #endregion if (string.IsNullOrEmpty(appInfo.AppName)) { this.Alert("资料不完整,请完善后再试"); return; } //写入数据库 bool result = new AppInfoBLL().Update(appInfo); //判断是否修改成功 if (result) { if (this.CheckBox1.Checked == true) { new AppCommentSummaryBLL().UpdateSummary(appInfo.AppID, appInfo.DownTimes, appInfo.RecommLevel); } if (this.AppClass == "12") { OperateRecordEntity info = new OperateRecordEntity() { ElemId = appInfo.AppID, reason = "", Status = 1, OperateFlag = "2", OperateType = "2", OperateExplain = "修改游戏信息", SourcePage = 1, OperateContent = appInfo.ShowName, UserName = GetUserName(), }; new OperateRecordBLL().Insert(info); this.Alert("操作成功", string.Format("GameInfoList.aspx")); } else { this.Alert("操作成功", string.Format("AppInfoList.aspx")); } } else { this.Alert("操作失败"); } }