Beispiel #1
0
 private void MenuBind()
 {
     BLL.ExtendGame bllExtend = new BLL.ExtendGame();
     DataTable dt = bllExtend.GetListByUserId(hduserid.Value).Tables[0];
     ddlMenu.DataSource = dt;
     ddlMenu.DataTextField = "Title";
     ddlMenu.DataValueField = "Title";
     ddlMenu.DataBind();
     ListItem item = new ListItem("汇总", "0");
     ddlMenu.Items.Insert(0, item);
 }
Beispiel #2
0
        protected void btnSave2_Click(object sender, EventArgs e)
        {
            int dbcount=0;
            BLL.ExtendGame extgame = new BLL.ExtendGame();
            Model.ExtendGame model = new Model.ExtendGame();
            try
            {
                string str = this.hdValue.Value;
                string[] strArr = str.Split(',');
                StringBuilder sqlWehere = new StringBuilder();
                sqlWehere.Append(" UserID='" + hduid.Value + "' and ChanelID='" + hdcid.Value + "' ");
                if (strArr.Length > 1)
                {
                    sqlWehere.Append(" and gameName not in (");
                    for (int i = 0; i < strArr.Length - 1; i++)
                    {
                        if (i == 0)
                        {
                            sqlWehere.Append("'" + strArr[i] + "'");
                        }
                        else
                        {
                            sqlWehere.Append(",'" + strArr[i] + "'");
                        }
                    }
                    sqlWehere.Append(") ");
                }
                extgame.Delete(sqlWehere.ToString());

                if (this.hdValue.Value != "")//计算提交打包数量
                {
                    dbcount = 0;
                    model.Status = "正在打包";
                    model.UpdateType = "N/A";
                    model.UserID = int.Parse(hduid.Value);
                    model.ChanelID = int.Parse(hdcid.Value);
                    model.ChanelName = hdcname.Value;
                    for (int i = 0; i < strArr.Length - 1; i++)
                    {
                        model.UpdateDate = DateTime.Now;
                        model.OnTime = DateTime.Now;
                        model.gameID = 0;
                        model.gameName = strArr[i].Trim();
                        if (!extgame.Exists(int.Parse(hduid.Value), int.Parse(hdcid.Value), model.gameName))
                        {
                            dbcount++;
                        }
                    }
                }

                string countwhere = "[Status] ='正在打包' and ChanelID  ='" + hdcid.Value + "' "; //计算正在打包数量

                if (extgame.GetCount(countwhere) + dbcount > 5)
                {
                    Model.Log modLog = new Model.Log();
                    modLog.UserId = int.Parse(hdcid.Value);
                    modLog.UserName = hdcname.Value;
                    InsertLog(modLog);
                    string myScript = @"alertRedirectMsg('打包序列不能超过5个,请耐心等待!','error.gif','Channel.aspx');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                }
                else 
                {
                    if (this.hdValue.Value != "")
                    {
                        model.Status = "正在打包";
                        model.UpdateType = "N/A";
                        model.UserID = int.Parse(hduid.Value);
                        model.ChanelID = int.Parse(hdcid.Value);
                        model.ChanelName = hdcname.Value;
                        for (int i = 0; i < strArr.Length - 1; i++)
                        {
                            model.UpdateDate = DateTime.Now;
                            model.OnTime = DateTime.Now;
                            model.gameID = 0;
                            model.gameName = strArr[i].Trim();
                            model.Verifycode = VerifycodeUtils.genVerifycode(6);
                            if (!extgame.Exists(int.Parse(hduid.Value), int.Parse(hdcid.Value), model.gameName))
                            {
                                extgame.Add(model);
                            }
                        }
                    }
               

                    Model.Log modLog = new Model.Log();
                    modLog.UserId = int.Parse(hdcid.Value);
                    modLog.UserName = hdcname.Value;
                    InsertLog(modLog);
                    string myScript = @"alertRedirectMsg('保存成功,系统正为您准备推广包,等待时间约为几分钟......','success.gif','Downloadgames.aspx?cooperateModelId= " + Request.Params["cooperateId"].ToString() + "');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true); 
                }
           

                
            }
            catch
            {
                string myScript = @"alertRedirectMsg('保存错误!','error.gif','Channel.aspx');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            }
        }