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); }
private void Add() { GroupElemsEntity entity = new GroupElemsEntity(); entity.GroupID = new GroupBLL().LauncherRecommendGetGroupId(SchemeID, GroupTypeID); entity.PosID = this.PosID; entity.ElemType = this.ElemType.SelectedValue.Convert <int>(1); entity.GroupType = this.GroupType.Value.Convert <int>(0); entity.OrderNo = this.OrderNo; entity.ElemID = this.ElemID.Value.Convert <int>(0); entity.RecommTitle = this.RecommTitle.Value.Trim(); entity.RecommPicUrl = this.MainIconPicUrl.Value.Trim(); entity.RecommWord = this.RecommWord.Text; entity.RecommVal = this.RecommVal.Value.Convert <int>(0); entity.Status = this.Status.SelectedValue.Convert <int>(0); entity.Remarks = this.Remarks.Text.Trim(); entity.StartTime = DateTime.Now.AddYears(-100); entity.EndTime = DateTime.Now.AddYears(100); if (new GroupElemsBLL().IsExist(entity)) { this.Alert("当前应用已存在,添加失败"); } else { bool result = new GroupElemsBLL().Insert(entity); if (result) { if (SchemeID == 104) { OperateRecordEntity info = new OperateRecordEntity() { ElemId = entity.ElemID, reason = "", Status = 1, OperateFlag = "1", SourcePage = 65, OperateType = "9", OperateExplain = "热门管理:新增游戏", OperateContent = new AppInfoBLL().GetSingle(entity.ElemID).ShowName, UserName = GetUserName(), }; new OperateRecordBLL().Insert(info); } // this.Alert("添加成功", string.Format("LauncherRecommendList.aspx?acttype={0}",ActType)); Response.Redirect(string.Format("LauncherRecommendList.aspx?acttype={0}&page={1}", ActType, PageType)); } else { this.Alert("添加失败"); } } }
private void Bind() { List <GroupElemsEntity> list = new GroupElemsBLL().QueryGroupElementByGroupID(GroupID); DataList1.DataSource = list; DataList1.DataBind(); if (PageType == "new") { Button1.Visible = true; } }
private void Edit() { this.CurrentEntity = new GroupElemsEntity(); CurrentEntity.GroupElemID = this.Id.Convert <int>(0); CurrentEntity.GroupID = new GroupBLL().HomePageRecommendGetGroupId(this.GroupTypeID, this.SchemeID); CurrentEntity.PosID = this.PosID; CurrentEntity.ElemType = this.ElemType.SelectedValue.Convert <int>(1); CurrentEntity.GroupType = GroupTypeID; CurrentEntity.OrderNo = this.OrderNo; CurrentEntity.ShowType = this.ShowType.SelectedValue.Convert <int>(0); //跳转至单机或网游时元素ID为0 if (this.ElemType.SelectedValue == "4") { CurrentEntity.ElemID = 0; CurrentEntity.GroupType = this.Request <int>("gameType", 0); } else { CurrentEntity.ElemID = this.ElemID.Value.Convert <int>(0); } if (this.RecommPicUrl.Value != "") { CurrentEntity.RecommPicUrl = this.RecommPicUrl.Value; } else { CurrentEntity.RecommPicUrl = this.MainIconPicUrl.Value; } CurrentEntity.StartTime = this.StartTime.Text.Trim().Convert <DateTime>(DateTime.Now); CurrentEntity.EndTime = this.EndTime.Text.Trim().Convert <DateTime>(DateTime.Now.AddDays(7)); CurrentEntity.RecommTitle = this.RecommTitle.Text.Trim(); CurrentEntity.RecommTag = Convert.ToInt32(this.RecommTag.Text.Trim()); CurrentEntity.RecommWord = this.RecommWord.Text.Trim(); CurrentEntity.Status = this.Status.SelectedValue.Convert <int>(0); CurrentEntity.Remarks = this.Remarks.Text.Trim(); bool result = new GroupElemsBLL().Update(CurrentEntity); if (result) { this.Alert("修改成功", string.Format("GameRecommendationList.aspx?Action={0},{1}", this.GroupTypeID, this.SchemeID)); } else { this.Alert("修改失败"); } }
private void Add() { GroupElemsEntity entity = new GroupElemsEntity(); entity.GroupID = new GroupBLL().HomePageRecommendGetGroupId(this.GroupTypeID, this.SchemeID); entity.PosID = this.PosID; entity.ElemType = this.ElemType.SelectedValue.Convert <int>(1); entity.GroupType = this.GroupType.Value.Convert <int>(0); entity.OrderNo = this.OrderNo; entity.ShowType = this.ShowType.SelectedValue.Convert <int>(0); // Banner位,OrderNo处理 // 取最大的OrderNo+1 if (this.PosID == 1) { string strWhere = string.Format(" GroupID={0} and PosID={1}", entity.GroupID, PosID); List <GroupElemsEntity> groupElemsList = new GroupBLL().GetList(1, strWhere, " orderNo desc"); if (groupElemsList != null && groupElemsList.Count > 0) { entity.OrderNo = groupElemsList[0].OrderNo + 1; } } //跳转至单机或网游时元素ID为0 if (this.ElemType.SelectedValue == "4") { entity.ElemID = 0; entity.GroupType = this.Request <int>("gameType", 0); } else { entity.ElemID = this.ElemID.Value.Convert <int>(0); } //if (entity.ShowType == 0) //{ // entity.RecommPicUrl = this.MainIconPicUrl.Value; // if (this.MainIconPicUrl.Value.Trim() == "") // { // CurrentEntity.RecommPicUrl = this.RecommPicUrl.Value; // } //} //else if (entity.ShowType == 1) //{ // entity.RecommPicUrl = this.RecommPicUrl.Value; //} //else //{ // entity.RecommPicUrl = string.Empty; //} entity.RecommPicUrl = this.RecommPicUrl.Value; if (this.RecommPicUrl.Value.Trim() == "") { entity.RecommPicUrl = this.MainIconPicUrl.Value; } entity.StartTime = this.StartTime.Text.Trim().Convert <DateTime>(DateTime.Now); entity.EndTime = this.EndTime.Text.Trim().Convert <DateTime>(DateTime.Now.AddDays(7)); entity.RecommTitle = this.RecommTitle.Text.Trim(); entity.RecommWord = this.RecommWord.Text.Trim(); entity.RecommTag = GetRecommTag(); entity.Status = this.Status.SelectedValue.Convert <int>(0); entity.Remarks = this.Remarks.Text.Trim(); if (new GroupElemsBLL().IsExist(entity)) { this.Alert("当前应用已存在,添加失败"); } else { bool result = new GroupElemsBLL().Insert(entity); if (result) { if (SchemeID == 104) { OperateRecordEntity info = new OperateRecordEntity() { ElemId = entity.GroupElemID, reason = "", Status = 1, OperateFlag = "1", OperateType = "1", SourcePage = 60, OperateExplain = "首页推荐位增加", UserName = GetUserName(), }; if (entity.PosID == 1) { info.OperateContent = entity.RecommTitle + "(Bnaner)"; } else { if (entity.ShowType == 1) { info.OperateContent = entity.RecommTitle + "(广告位)"; } else { info.OperateContent = entity.RecommTitle + "(推荐位)"; } } new OperateRecordBLL().Insert(info); } this.Alert("添加成功", string.Format("HomePageRecommendByAppCenterList.aspx?acttype={0},{1}&page={2}", this.GroupTypeID, this.SchemeID, this.PageType)); } else { this.Alert("添加失败"); } } }
private void Edit() { this.CurrentEntity = new GroupElemsEntity(); CurrentEntity.GroupElemID = this.Id.Convert <int>(0); CurrentEntity.GroupID = new GroupBLL().HomePageRecommendGetGroupId(this.GroupTypeID, this.SchemeID); CurrentEntity.PosID = this.PosID; CurrentEntity.ElemType = this.ElemType.SelectedValue.Convert <int>(1); CurrentEntity.GroupType = this.GroupType.Value.Convert <int>(0); CurrentEntity.OrderNo = this.OrderNo; CurrentEntity.ShowType = this.ShowType.SelectedValue.Convert <int>(0); //跳转至单机或网游时元素ID为0 if (this.ElemType.SelectedValue == "4") { CurrentEntity.ElemID = 0; CurrentEntity.GroupType = this.Request <int>("gameType", 0); } else { CurrentEntity.ElemID = this.ElemID.Value.Convert <int>(0); } //if (CurrentEntity.ShowType == 0) //{ // CurrentEntity.RecommPicUrl = this.MainIconPicUrl.Value; //} //else if (CurrentEntity.ShowType == 1) //{ // CurrentEntity.RecommPicUrl = this.RecommPicUrl.Value; //} //else //{ // CurrentEntity.RecommPicUrl = string.Empty; //} CurrentEntity.RecommPicUrl = this.RecommPicUrl.Value; if (this.RecommPicUrl.Value.Trim() == "") { CurrentEntity.RecommPicUrl = this.MainIconPicUrl.Value; } CurrentEntity.StartTime = this.StartTime.Text.Trim().Convert <DateTime>(DateTime.Now); CurrentEntity.EndTime = this.EndTime.Text.Trim().Convert <DateTime>(DateTime.Now.AddDays(7)); CurrentEntity.RecommTitle = this.RecommTitle.Text.Trim(); CurrentEntity.RecommTag = GetRecommTag(); CurrentEntity.RecommWord = this.RecommWord.Text.Trim(); CurrentEntity.RecommTag = GetRecommTag(); CurrentEntity.Status = this.Status.SelectedValue.Convert <int>(0); CurrentEntity.Remarks = this.Remarks.Text.Trim(); bool result = new GroupElemsBLL().Update(CurrentEntity); if (result) { if (SchemeID == 104) { OperateRecordEntity info = new OperateRecordEntity() { ElemId = CurrentEntity.GroupElemID, reason = "", Status = 1, OperateFlag = "2", OperateType = "1", OperateExplain = "首页推荐位修改", SourcePage = 60, UserName = GetUserName(), }; if (CurrentEntity.PosID == 1) { info.OperateContent = CurrentEntity.RecommTitle + "(Bnaner)"; } else { if (CurrentEntity.ShowType == 1) { info.OperateContent = CurrentEntity.RecommTitle + "(广告位)"; } else { info.OperateContent = CurrentEntity.RecommTitle + "(推荐位)"; } } new OperateRecordBLL().Insert(info); } this.Alert("修改成功", string.Format("HomePageRecommendByAppCenterList.aspx?acttype={0},{1}&page={2}", this.GroupTypeID, this.SchemeID, this.PageType)); } else { this.Alert("修改失败"); } }
private void Add() { GroupElemsEntity entity = new GroupElemsEntity(); entity.GroupID = new GroupBLL().HomePageRecommendGetGroupId(this.GroupTypeID, this.SchemeID); entity.PosID = this.PosID; entity.ElemType = this.ElemType.SelectedValue.Convert <int>(1); entity.GroupType = GroupTypeID; entity.OrderNo = this.OrderNo; entity.ShowType = this.ShowType.SelectedValue.Convert <int>(0); // Banner位,OrderNo处理 // 取最大的OrderNo+1 if (this.PosID == 1) { string strWhere = string.Format(" GroupID={0} and PosID={1}", entity.GroupID, PosID); List <GroupElemsEntity> groupElemsList = new GroupBLL().GetList(1, strWhere, " orderNo desc"); if (groupElemsList != null && groupElemsList.Count > 0) { entity.OrderNo = groupElemsList[0].OrderNo + 1; } } //跳转至单机或网游时元素ID为0 if (this.ElemType.SelectedValue == "4") { entity.ElemID = 0; entity.GroupType = this.Request <int>("gameType", 0); } else { entity.ElemID = this.ElemID.Value.Convert <int>(0); } if (this.RecommPicUrl.Value != "") { entity.RecommPicUrl = this.RecommPicUrl.Value; } else { entity.RecommPicUrl = this.MainIconPicUrl.Value; } entity.StartTime = this.StartTime.Text.Trim().Convert <DateTime>(DateTime.Now); entity.EndTime = this.EndTime.Text.Trim().Convert <DateTime>(DateTime.Now.AddDays(7)); entity.RecommTitle = this.RecommTitle.Text.Trim(); entity.RecommTag = Convert.ToInt32(this.RecommTag.Text.Trim()); entity.RecommWord = this.RecommWord.Text.Trim(); entity.Status = this.Status.SelectedValue.Convert <int>(0); entity.Remarks = this.Remarks.Text.Trim(); if (new GroupElemsBLL().IsExist(entity)) { this.Alert("当前应用已存在,添加失败"); } else { bool result = new GroupElemsBLL().Insert(entity); if (result) { this.Alert("添加成功", string.Format("GameRecommendationList.aspx?Action={0},{1}", this.GroupTypeID, this.SchemeID)); } else { this.Alert("添加失败"); } } }
protected void OnSave_Click(object sender, EventArgs e) { var currentEntity = new GroupElemsEntity(); currentEntity.GroupID = GroupID; currentEntity.GroupElemID = GroupElementID; currentEntity.ElemID = nwbase_sdk.Tools.GetInt(hfAppID.Value, 0); currentEntity.ElemType = 1; currentEntity.RecommPicUrl = hfIconUrl.Value; currentEntity.RecommTitle = txtShowName.Text; currentEntity.RecommWord = txtRecommWord.Text; currentEntity.StartTime = DateTime.ParseExact(txtStartTime.Text, "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.CurrentCulture); currentEntity.EndTime = DateTime.ParseExact(txtEndTime.Text, "yyyy-MM-dd HH:mm", System.Globalization.CultureInfo.CurrentCulture); currentEntity.Status = nwbase_sdk.Tools.GetInt(ddlStatus.SelectedValue, 1); currentEntity.Remarks = string.Empty; currentEntity.PosID = txtPosID.Text.Trim().Convert <int>(0); //判断同一分组,位置编号是否重复 bool answer = new GroupBLL().IsExistPosID(currentEntity); if (answer) { this.Alert("位置编号不能重复"); return; } if (txtPosID.Text.Trim().Convert <int>(0) < 1) { this.Alert("位置编号不能小于1"); return; } if (txtPosID.Text.Trim().Convert <int>(0) > 500) { this.Alert("位置编号不能大于500"); return; } bool result = false; if (GroupElementID <= 0) { //新增 // 如果同一分组内存在相同元素 if (new GroupElemsBLL().ExistSameElementIDInGroup(currentEntity.GroupID, currentEntity.ElemID)) { this.Alert("此分组存在相同元素..."); return; } result = new GroupElemsBLL().InsertGroupElement(currentEntity); if (SchemeID == 104) { OperateRecordEntity info = new OperateRecordEntity() { ElemId = 0, reason = "", Status = 1, OperateFlag = "1", OperateContent = GroupName + "(" + new AppInfoBLL().GetSingle(currentEntity.ElemID).ShowName + ")", UserName = GetUserName(), }; if (GroupID != 93 && GroupID != 94) { info.SourcePage = 62; info.OperateType = "6"; info.OperateExplain = "分类列表:新增游戏"; } else { if (GroupID == 93) { info.SourcePage = 63; info.OperateType = "7"; info.OperateExplain = "游戏排行: 新增游戏"; } else if (GroupID == 94) { info.SourcePage = 64; info.OperateType = "8"; info.OperateExplain = "最新游戏: 新增游戏"; } } new OperateRecordBLL().Insert(info); } } else { // 修改 result = new GroupBLL().BeginnerRecommendUpdate(currentEntity); if (SchemeID == 104) { OperateRecordEntity info = new OperateRecordEntity() { ElemId = GroupElementID, reason = "", Status = 1, OperateFlag = "2", OperateContent = GroupName + "(" + new AppInfoBLL().GetSingle(currentEntity.ElemID).ShowName + ")", UserName = GetUserName(), }; if (GroupID != 93 && GroupID != 94) { info.SourcePage = 62; info.OperateType = "6"; info.OperateExplain = "分类列表:编辑游戏"; } else { if (GroupID == 93) { info.SourcePage = 63; info.OperateType = "7"; info.OperateExplain = "游戏排行: 编辑游戏"; } else if (GroupID == 94) { info.SourcePage = 64; info.OperateType = "8"; info.OperateExplain = "最新游戏: 编辑游戏"; } } new OperateRecordBLL().Insert(info); } } if (result) { this.Alert("保存成功", string.Format("GroupElement.aspx?GroupID=" + GroupID + "&GroupName=" + GroupName + "&SchemeID=" + SchemeID + "&page=" + PageType)); } else { this.Alert("保存失败!"); } }
private void Bind() { int posId = Tools.GetRequestVal("PosID", -1); int orderNo = Tools.GetRequestVal("order", -1); PosId = posId; OrderNo = orderNo; if (posId < 0) { return; } var allList = new GroupBLL().HomePageRecommendGetElemsByPosId(posId, this.GroupTypeID, this.SchemeID); if (GroupElemID > 0) { allList = new GroupElemsBLL().GetGroupEntityByID(GroupElemID); } // 根据orderNo过滤 //if (orderNo >= 0) //{ // List<GroupElemsEntity> newList = new List<GroupElemsEntity>(); // for (int i = 0; i < allList.Count; i++) // { // if (allList[i].OrderNo == orderNo) // newList.Add(allList[i]); // } // allList = newList; //} var runningList = new List <GroupElemsEntity>(); var toRunList = new List <GroupElemsEntity>(); var expiredList = new List <GroupElemsEntity>(); DateTime currentTime = DateTime.Now; foreach (var eachItem in allList) { if (eachItem.EndTime < currentTime) { //已过期 expiredList.Add(eachItem); } else if (eachItem.StartTime > currentTime) { //即将启用 toRunList.Add(eachItem); } else { //启用中 runningList.Add(eachItem); } } RunningList.DataSource = runningList; ToRunList.DataSource = toRunList; ExpiredList.DataSource = expiredList; RunningList.DataBind(); ToRunList.DataBind(); ExpiredList.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { DataSet dataset = new DataSet(); DataTable datatable = new DataTable(); dataset = new GroupElemsBLL().QueryDataSetByGroupID2(GroupID); datatable = GetGroupInfo(GroupID); DataTable dt = dataset.Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < dt.Columns.Count; j++) { if (dt.Columns[j].ColumnName.ToString() == "PosID") { int posid = int.Parse(dt.Rows[i][j].ToString()); int id = int.Parse(dt.Rows[i][4].ToString()); AppInfoEntity entity = new AppInfoBLL().GetSingle(id); int a = 0; for (int k = 0; k < datatable.Rows.Count; k++) { if (int.Parse(datatable.Rows[k][datatable.Columns.Count - 1].ToString()) == id) { a = k; } } if (a > 0) { datatable.Rows.RemoveAt(a); } DataRow drr = datatable.NewRow(); if (entity != null) { drr["ID"] = entity.AppID; drr["游戏名"] = entity.ShowName; drr["包名"] = entity.PackName; drr["版本"] = entity.MainVerName; AppTypeEntity type = new AppTypeBLL().GetSingle(entity.AppType); if (type != null) { drr["游戏分类"] = type.AppTypeName; } drr["合作类型"] = entity.CoopType; drr["开发者"] = entity.DevName; drr["状态"] = entity.Status; PackInfoEntity info = new PackInfoBLL().GetSingle(entity.MainPackID); if (info != null) { drr["调用权限"] = info.permission; } } //datatable.Rows.RemoveAt(posid-1); datatable.Rows.InsertAt(drr, posid - 1); } } } } string fileName = string.Format("GroupInfo_{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss")); string path = Server.MapPath(ServerMapPath() + fileName); new AppInfoListNew().WriteExcel2(BaseCommon.DtSelectTop(500, datatable), path, fileName); DownloadFile(path); }