private void Bind() { if (_Id > 0) { _CurrentEntity = new GroupBLL().GetGroupElemByID(_Id); if (_CurrentEntity != null) { hfAppID.Value = _CurrentEntity.ElemID.ToString(); hfIconUrl.Value = _CurrentEntity.RecommPicUrl; txtShowName.Text = _CurrentEntity.RecommTitle; txtRecommWord.Text = _CurrentEntity.RecommWord; txtStartTime.Text = _CurrentEntity.StartTime.ToString("yyyy-MM-dd HH:mm"); txtEndTime.Text = _CurrentEntity.EndTime.ToString("yyyy-MM-dd HH:mm"); ddlStatus.SelectedValue = _CurrentEntity.Status.ToString(); txtPosID.Text = _CurrentEntity.PosID.ToString(); } } else { // 绑定最大位置id Tips var currentEntity = new GroupElemsEntity(); currentEntity.GroupID = new GroupBLL().BeginnerRecommendGetGroupId(this.GroupTypeID, this.SchemeID); int posid = new GroupBLL().GetMaxPosID(currentEntity); txtStartTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); txtEndTime.Text = DateTime.Now.AddYears(10).ToString("yyyy-MM-dd HH:mm"); if (posid > 0) { labelPosIDTips.Text = "目前已设置的最大位置id:" + posid.ToString(); } txtPosID.Text = Tools.GetStr(posid + 1, "0"); } }
/// <summary> /// 更新精品桌面的推荐内容 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool UpdateLauncherRecommend(GroupElemsEntity entity) { #region CommandText string commandText = @"UPDATE GroupElems SET GroupElemID = @GroupElemID, ElemID = @ElemID, RecommTitle = @RecommTitle, RecommWord = @RecommWord, RecommPicUrl = @RecommPicUrl, RecommVal = @RecommVal, STATUS = @STATUS, Remarks = @Remarks, UpdateTime = NOW() WHERE GroupElemID=@GroupElemID "; #endregion List <MySqlParameter> paramsList = new List <MySqlParameter>(); paramsList.Add(new MySqlParameter("@GroupElemID", entity.GroupElemID)); paramsList.Add(new MySqlParameter("@ElemID", entity.ElemID)); paramsList.Add(new MySqlParameter("@RecommTitle", entity.RecommTitle)); paramsList.Add(new MySqlParameter("@RecommWord", entity.RecommWord)); paramsList.Add(new MySqlParameter("@RecommPicUrl", entity.RecommPicUrl)); paramsList.Add(new MySqlParameter("@RecommVal", entity.RecommVal)); paramsList.Add(new MySqlParameter("@STATUS", entity.Status)); paramsList.Add(new MySqlParameter("@Remarks", entity.Remarks)); return(MySqlHelper.ExecuteNonQuery(this.ConnectionString, commandText, paramsList.ToArray()) > 0 ? true : false); }
private void Bind() { if (GroupElementID > 0) { _CurrentEntity = new GroupBLL().GetGroupElemByID(GroupElementID); if (_CurrentEntity != null) { hfAppID.Value = _CurrentEntity.ElemID.ToString(); hfIconUrl.Value = _CurrentEntity.RecommPicUrl; txtShowName.Text = _CurrentEntity.RecommTitle; txtRecommWord.Text = _CurrentEntity.RecommWord; txtStartTime.Text = _CurrentEntity.StartTime.ToString("yyyy-MM-dd HH:mm"); txtEndTime.Text = _CurrentEntity.EndTime.ToString("yyyy-MM-dd HH:mm"); ddlStatus.SelectedValue = _CurrentEntity.Status.ToString(); txtPosID.Text = _CurrentEntity.PosID.ToString(); } } // 绑定最大位置id Tips var currentEntity = new GroupElemsEntity(); currentEntity.GroupID = GroupID; int posid = new GroupBLL().GetMaxPosID(currentEntity); //todo: }
/// <summary> /// 更新分组元素信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Update(GroupElemsEntity entity) { #region CommandText string commandText = @"UPDATE `GroupElems` SET `PosID` = @PosID, `ElemType` = @ElemType, `ElemID` = @ElemID, `GroupType` = @GroupType, `OrderType` = @OrderType, `OrderNo` = @OrderNo, `RecommVal` = @RecommVal, `RecommTitle` = @RecommTitle, `RecommTag` = @RecommTag, `RecommWord` = @RecommWord, `RecommPicUrl` = @RecommPicUrl, `Remarks` = @Remarks, `StartTime` = @StartTime, `EndTime` = @EndTime, `UpdateTime` = @UpdateTime, `ShowType` = @ShowType, `Status` = @Status WHERE `GroupElemID` = @GroupElemID;"; #endregion return(ExecuteNonQuery(commandText, entity)); }
protected string BindTime(object entity) { GroupElemsEntity obj = (GroupElemsEntity)entity; string timePart = string.Format("{0:yyyy.MM.dd HH:mm} ~ {1:yyyy.MM.dd HH:mm}", obj.StartTime, obj.EndTime); return(timePart); }
private List <MySqlParameter> GetMySqlParameters(GroupElemsEntity entity) { List <MySqlParameter> paramsList = new List <MySqlParameter>(); paramsList.Add(new MySqlParameter("@GroupElemID", entity.GroupElemID)); paramsList.Add(new MySqlParameter("@GroupID", entity.GroupID)); paramsList.Add(new MySqlParameter("@PosID", entity.PosID)); paramsList.Add(new MySqlParameter("@ElemType", entity.ElemType)); paramsList.Add(new MySqlParameter("@ElemID", entity.ElemID)); paramsList.Add(new MySqlParameter("@GroupType", entity.GroupType)); paramsList.Add(new MySqlParameter("@OrderType", entity.OrderType)); paramsList.Add(new MySqlParameter("@OrderNo", entity.OrderNo)); paramsList.Add(new MySqlParameter("@RecommVal", entity.RecommVal)); paramsList.Add(new MySqlParameter("@RecommTitle", entity.RecommTitle)); paramsList.Add(new MySqlParameter("@RecommTag", entity.RecommTag)); paramsList.Add(new MySqlParameter("@RecommWord", entity.RecommWord)); paramsList.Add(new MySqlParameter("@RecommPicUrl", entity.RecommPicUrl)); paramsList.Add(new MySqlParameter("@Remarks", entity.Remarks)); paramsList.Add(new MySqlParameter("@StartTime", entity.StartTime)); paramsList.Add(new MySqlParameter("@EndTime", entity.EndTime)); 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("@Status", entity.Status)); paramsList.Add(new MySqlParameter("@ShowType", entity.ShowType)); paramsList.Add(new MySqlParameter("@StartIndex", entity.StartIndex)); paramsList.Add(new MySqlParameter("@EndIndex", entity.EndIndex)); return(paramsList); }
private bool ExecuteNonQuery(string commandText, GroupElemsEntity entity) { List <MySqlParameter> paramsList = GetMySqlParameters(entity); int result = MySqlHelper.ExecuteNonQuery(this.ConnectionString, commandText, paramsList.ToArray()); return(base.ExecuteStatus(result)); }
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("添加失败"); } } }
protected void OnSave(object sender, EventArgs e) { var currentEntity = new GroupElemsEntity(); currentEntity.GroupElemID = _Id; 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.UpdateTime = DateTime.Now; currentEntity.Remarks = string.Empty; currentEntity.GroupID = new GroupBLL().BeginnerRecommendGetGroupId(this.GroupTypeID, this.SchemeID); currentEntity.OrderNo = Tools.GetRequestVal("order", 0); currentEntity.PosID = txtPosID.Text.Trim().Convert <int>(0); //判断同一分组,位置编号是否重复 bool answer = new GroupBLL().IsExistPosID(currentEntity); if (answer) { this.Alert("位置编号不能重复"); return; } bool result = false; if (_Id <= 0) { //新增 currentEntity.CreateTime = DateTime.Now; result = new GroupBLL().BeginnerRecommendInsert(currentEntity); } else { result = new GroupBLL().BeginnerRecommendUpdate(currentEntity); } if (result) { this.Alert("保存成功"); Bind(); } else { this.Alert("保存失败!"); } }
public bool Insert(GroupElemsEntity entity) { string commandText = @"INSERT INTO `GroupElems` (`GroupElemID`, `GroupID`, `PosID`, `ElemType`, `ElemID`, `ShowType`, `GroupType`, `OrderType`, `OrderNo`, `RecommVal`, `RecommTitle`, `RecommTag`, `RecommWord`, `RecommPicUrl`, `Remarks`, `StartTime`, `EndTime`, `CreateTime`, `UpdateTime`, `Status`) VALUES ( @GroupElemID, @GroupID, @PosID, @ElemType, @ElemID, @ShowType, @GroupType, @OrderType, @OrderNo, @RecommVal, @RecommTitle, @RecommTag, @RecommWord, @RecommPicUrl, @Remarks, @StartTime, @EndTime, @CreateTime, @UpdateTime, @Status ); "; return(ExecuteNonQuery(commandText, entity)); }
/// <summary> /// 判断同一分组,位置编号是否重复 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool IsExistPosID(GroupElemsEntity entity) { #region CommandText string commandText = @"SELECT COUNT(0) FROM GroupElems WHERE GroupID=@GroupID and Status=1 and PosID = @PosID and GroupElemID <> @GroupElemID"; #endregion List <MySqlParameter> paramsList = this.GetMySqlParameters(entity); int result = MySqlHelper.ExecuteScalar(this.ConnectionString, commandText, paramsList.ToArray()).Convert <int>(0); return(this.ExecuteStatus(result)); }
/// <summary> /// 判断推荐元素是否已存在 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool IsExist(GroupElemsEntity entity) { #region CommandText string commandText = @"SELECT COUNT(0) FROM GroupElems WHERE GroupID=@GroupID AND GroupType=@GroupType AND ElemID = @ElemID AND ElemID != 0 AND Status = 1 AND StartTime < NOW() and EndTime > Now()"; #endregion List <MySqlParameter> paramsList = this.GetMySqlParameters(entity); int result = MySqlHelper.ExecuteScalar(this.ConnectionString, commandText, paramsList.ToArray()).Convert <int>(0); return(this.ExecuteStatus(result)); }
public int InsertForId(GroupElemsEntity entity) { string commandText = @"INSERT INTO `GroupElems` (`GroupElemID`, `GroupID`, `PosID`, `ElemType`, `ElemID`, `GroupType`, `OrderType`, `OrderNo`, `RecommVal`, `RecommTitle`, `RecommTag`, `RecommWord`, `RecommPicUrl`, `Remarks`, `StartTime`, `EndTime`, `CreateTime`, `UpdateTime`, `Status`) VALUES ( @GroupElemID, @GroupID, @PosID, @ElemType, @ElemID, @GroupType, @OrderType, @OrderNo, @RecommVal, @RecommTitle, @RecommTag, @RecommWord, @RecommPicUrl, @Remarks, @StartTime, @EndTime, @CreateTime, @UpdateTime, @Status);select last_insert_id(); "; return(Tools.GetInt(MySqlHelper.ExecuteScalar(this.ConnectionString, commandText, GetMySqlParameters(entity).ToArray()), 0)); }
private void Bind() { if (_Id > 0) { _CurrentEntity = new GroupBLL().GetGroupElemByID(_Id); if (_CurrentEntity != null) { hfAppID.Value = _CurrentEntity.ElemID.ToString(); hfIconUrl.Value = _CurrentEntity.RecommPicUrl; txtShowName.Text = _CurrentEntity.RecommTitle; txtStartTime.Text = _CurrentEntity.StartTime.ToString("yyyy-MM-dd HH:mm"); txtEndTime.Text = _CurrentEntity.EndTime.ToString("yyyy-MM-dd HH:mm"); ddlStatus.SelectedValue = _CurrentEntity.Status.ToString(); txtPosID.Text = _CurrentEntity.PosID.ToString(); } } }
/// <summary> /// 根据GroupID插入分组元素表 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool InsertGroupElement(GroupElemsEntity entity) { #region CommandText string commandText = @"INSERT INTO `GroupElems` (`GroupElemID`, `GroupID`, `PosID`, `ElemType`, `ElemID`, `GroupType`, `OrderType`, `OrderNo`, `RecommVal`, `RecommTitle`, `RecommWord`, `RecommPicUrl`, `Remarks`, `StartTime`, `EndTime`, `CreateTime`, `Status`) VALUES ( @GroupElemID, @GroupID, @PosID, @ElemType, @ElemID, @GroupType, @OrderType, @OrderNo, @RecommVal, @RecommTitle, @RecommWord, @RecommPicUrl, @Remarks, @StartTime, @EndTime, now(), @Status )"; #endregion return(ExecuteNonQuery(commandText, entity)); }
private void Update() { GroupElemsEntity entity = new GroupElemsEntity(); entity.GroupElemID = this.GroupElemID; 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(); bool result = new GroupBLL().UpdateLauncherRecommend(entity); if (result) { if (SchemeID == 104) { OperateRecordEntity info = new OperateRecordEntity() { ElemId = entity.ElemID, reason = "", Status = 1, OperateFlag = "2", SourcePage = 65, OperateType = "9", OperateExplain = "热门游戏管理:编辑游戏", OperateContent = new AppInfoBLL().GetSingle(entity.ElemID).ShowName, UserName = GetUserName(), }; new OperateRecordBLL().Insert(info); } //this.Alert("更新成功"); Response.Redirect(string.Format("LauncherRecommendList.aspx?acttype={0}&page={1}", ActType, PageType)); this.Alert("更新成功", Request.ApplicationPath + string.Format("LauncherRecommendList.aspx?acttype={0}&page={1}", ActType, PageType)); //Response.Redirect(Request.Url. "/LauncherRecommendList.aspx"); //Response.Redirect(Request.Url.AbsolutePath + string.Format("?acttype={0}", ActType)); } else { this.Alert("更新失败"); } }
/// <summary> /// 根据分组ID查询分组名称(绑定到导航) /// </summary> //private void QueryGroupNameByID() //{ // this.GroupName = new GroupInfoBll().QueryGroupNameByID(GroupID); //} protected string BindTimeStatus(object entity) { GroupElemsEntity obj = (GroupElemsEntity)entity; DateTime currentTime = DateTime.Now; if (obj.StartTime > currentTime || obj.EndTime < currentTime) { return("<span class=\"red\">不在有效日期 | 位置编号:" + obj.PosID + "</span> "); } else if (obj.EndTime.AddHours(-24) < currentTime) { return("<span class=\"blue\">启用中 | 位置编号:" + obj.PosID + "</span> "); } else { return("<span class=\"white\">启用中 | 位置编号:" + obj.PosID + "</span> "); } }
protected string BindStatus(object entity) { GroupElemsEntity obj = (GroupElemsEntity)entity; DateTime currentTime = DateTime.Now; if (obj.StartTime > currentTime || obj.EndTime < currentTime) { return("<span class=\"red\">已过期</span>"); } else if (obj.EndTime.AddHours(-24) < currentTime) { return("<span class=\"blue\">启用中</span>"); } else { return("<span class=\"white\">启用中</span>"); } }
private void Bind() { if (_Id > 0) { _CurrentEntity = new GroupBLL().GetGroupElemByID(_Id); if (_CurrentEntity != null) { txtRecommTitle.Text = _CurrentEntity.RecommTitle; txtStartTime.Text = _CurrentEntity.StartTime.ToString("yyyy-MM-dd HH:mm"); txtEndTime.Text = _CurrentEntity.EndTime.ToString("yyyy-MM-dd HH:mm"); ddlStatus.SelectedValue = _CurrentEntity.Status.ToString(); } } else { txtStartTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); txtEndTime.Text = "2025-01-01 00:00"; } }
protected string BindTime(object entity) { GroupElemsEntity obj = (GroupElemsEntity)entity; string timePart = string.Format("{0:yyyy.MM.dd HH:mm} ~ {1:yyyy.MM.dd HH:mm}", obj.StartTime, obj.EndTime); DateTime currentTime = DateTime.Now; if (obj.StartTime > currentTime || obj.EndTime < currentTime) { return("<span class=\"red\">" + timePart + "</span>"); } else if (obj.EndTime.AddHours(-24) < currentTime) { return("<span class=\"blue\">" + timePart + "</span>"); } else { return("<span class=\"white\">" + timePart + "</span>"); } }
protected string BindTime(object entity) { GroupElemsEntity obj = (GroupElemsEntity)entity; string timePart = string.Format("{0:yyyy.MM.dd HH:mm} ~<br/> {1:yyyy.MM.dd HH:mm}", obj.StartTime, obj.EndTime); DateTime currentTime = DateTime.Now; if (obj.EndTime < currentTime) { return("" + timePart + ""); } else if (obj.StartTime > currentTime) { return("" + timePart + ""); } else { return("" + timePart + ""); } }
protected string BindStatus(object entity) { GroupElemsEntity obj = (GroupElemsEntity)entity; DateTime currentTime = DateTime.Now; if (obj.EndTime < currentTime) { return("<span class=\"red\">已过期</span>"); } else if (obj.StartTime > currentTime) { var timeSpan = obj.StartTime - currentTime; return(string.Format("<span class=\"blue\">即将启用</span>")); } else { return("<span class=\"black\">开启</span>"); } }
/// <summary> /// 获取同一分组中,最大的位置id /// </summary> /// <param name="entity"></param> /// <returns></returns> public int GetMaxPosID(GroupElemsEntity entity) { #region CommandText string commandText = @"SELECT MAX(POSID) FROM GroupElems WHERE GroupID=@GroupID "; #endregion List <MySqlParameter> paramsList = this.GetMySqlParameters(entity); using (MySqlDataReader objReader = MySqlHelper.ExecuteReader(this.ConnectionString, commandText.ToString(), paramsList.ToArray())) { if (objReader.Read()) { return(Tools.GetInt(objReader[0], 0)); } } return(0); }
protected string BindStatus(object entity) { GroupElemsEntity obj = (GroupElemsEntity)entity; DateTime currentTime = DateTime.Now; if (obj.EndTime < currentTime) { return("<span class=\"red\">已过期</span>"); } //else if (obj.StartTime > currentTime) //{ // var timeSpan = obj.StartTime - currentTime; // return string.Format("<span class=\"blue\">开启 / {0}后显示</span>", timeSpan.Days > 0 ? timeSpan.Days.ToString() + "天" : timeSpan.Hours.ToString() + "小时"); //} else { return("开启"); } }
protected void OnSave(object sender, EventArgs e) { int maxPosId = new GroupBLL().MaxPisId(this.SchemeID); var currentEntity = new GroupElemsEntity(); currentEntity.GroupElemID = _Id; currentEntity.PosID = maxPosId + 1; currentEntity.ElemID = 0; currentEntity.ElemType = 6; currentEntity.RecommPicUrl = ""; currentEntity.RecommTitle = txtRecommTitle.Text; currentEntity.RecommWord = ""; 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.UpdateTime = DateTime.Now; currentEntity.Remarks = string.Empty; currentEntity.GroupID = new GroupBLL().SearchWordsGetGroupId(this.SchemeID); bool result = false; if (_Id <= 0) { //新增 currentEntity.CreateTime = DateTime.Now; result = new GroupBLL().SearchWordsInsert(currentEntity); } else { result = new GroupBLL().SearchWordsUpdate(currentEntity); } if (result) { this.Alert("保存成功"); Bind(); } else { this.Alert("保存失败!"); } }
public static int Add(int appid, string name, string pic, int gid) { var currentEntity = new GroupElemsEntity(); currentEntity.GroupElemID = 0; currentEntity.ElemID = appid; currentEntity.ElemType = 1; currentEntity.RecommPicUrl = pic; currentEntity.RecommTitle = name; currentEntity.RecommWord = ""; currentEntity.StartTime = new DateTime(1900, 1, 1); currentEntity.EndTime = new DateTime(2048, 1, 1); currentEntity.Status = 1; currentEntity.UpdateTime = DateTime.Now; currentEntity.Remarks = string.Empty; currentEntity.CreateTime = DateTime.Now; currentEntity.GroupID = gid; currentEntity.OrderNo = 0; return(new GroupBLL().InsertElemForId(currentEntity)); }
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 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("保存失败!"); } }
public int InsertElemForId(GroupElemsEntity entity) { return(new GroupElemsDAL().InsertForId(entity)); }