コード例 #1
0
ファイル: ExtendGame.cs プロジェクト: scutsky/iyuewan
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.ExtendGame DataRowToModel(DataRow row)
 {
     Model.ExtendGame model = new Model.ExtendGame();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["gameID"] != null && row["gameID"].ToString() != "")
         {
             model.gameID = int.Parse(row["gameID"].ToString());
         }
         if (row["ChanelID"] != null && row["ChanelID"].ToString() != "")
         {
             model.ChanelID = int.Parse(row["ChanelID"].ToString());
         }
         if (row["ChanelName"] != null)
         {
             model.ChanelName = row["ChanelName"].ToString();
         }
         if (row["UserID"] != null && row["UserID"].ToString() != "")
         {
             model.UserID = int.Parse(row["UserID"].ToString());
         }
         if (row["version"] != null)
         {
             model.version = row["version"].ToString();
         }
         if (row["Status"] != null)
         {
             model.Status = row["Status"].ToString();
         }
         if (row["UpdateType"] != null)
         {
             model.UpdateType = row["UpdateType"].ToString();
         }
         if (row["UpdateDate"] != null && row["UpdateDate"].ToString() != "")
         {
             model.UpdateDate = DateTime.Parse(row["UpdateDate"].ToString());
         }
         if (row["OnTime"] != null && row["OnTime"].ToString() != "")
         {
             model.OnTime = DateTime.Parse(row["OnTime"].ToString());
         }
         if (row["Bak1"] != null)
         {
             model.Bak1 = row["Bak1"].ToString();
         }
         if (row["Bak2"] != null)
         {
             model.Bak2 = row["Bak2"].ToString();
         }
         if (row["Bak3"] != null)
         {
             model.Bak3 = row["Bak3"].ToString();
         }
         if (row["Bak4"] != null)
         {
             model.Bak4 = row["Bak4"].ToString();
         }
         if (row["Bak5"] != null)
         {
             model.Bak5 = row["Bak5"].ToString();
         }
         if (row["gameName"] != null)
         {
             model.gameName = row["gameName"].ToString();
         }
         if (row["Verifycode"] != null)
         {
             model.Verifycode = row["Verifycode"].ToString();
         }
     }
     return model;
 }
コード例 #2
0
ファイル: Choosegames.aspx.cs プロジェクト: scutsky/iyuewan
        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);
            }
        }
コード例 #3
0
ファイル: ExtendGame.cs プロジェクト: scutsky/iyuewan
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.ExtendGame GetModel(int ID)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 ID,gameID,ChanelID,ChanelName,UserID,version,Status,UpdateType,UpdateDate,OnTime,Bak1,Bak2,Bak3,Bak4,Bak5,gameName,Verifycode from ExtendGame ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters = {
					new SqlParameter("@ID", SqlDbType.Int,4)
			};
            parameters[0].Value = ID;

            Model.ExtendGame model = new Model.ExtendGame();
            DataSet ds = DbHelper.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }