コード例 #1
0
ファイル: SolutionDAL.cs プロジェクト: rongxiong/Scut
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(SolutionModel model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("insert into Solutions(");
     strSql.Append("SlnName,Namespace,RefNamespace,Url,GameID)");
     strSql.Append(" values (");
     strSql.Append("@SlnName,@Namespace,@RefNamespace,@Url,@GameID)");
     strSql.Append(";select @@IDENTITY");
     SqlParameter[] parameters = {
             new SqlParameter("@SlnName", SqlDbType.VarChar, 0),
             new SqlParameter("@Namespace", SqlDbType.VarChar, 0),
             new SqlParameter("@RefNamespace", SqlDbType.VarChar, 0),
             new SqlParameter("@Url", SqlDbType.VarChar, 0),
              new SqlParameter("@GameID", SqlDbType.Int, 4)
             };
     parameters[0].Value = model.SlnName;
     parameters[1].Value = model.Namespace;
     parameters[2].Value = model.RefNamespace;
     parameters[3].Value = model.Url;
     parameters[4].Value = model.GameID;
     object obj = SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, strSql.ToString(), parameters);
     if (obj == null)
     {
         return 0;
     }
     else
     {
         return Convert.ToInt32(obj);
     }
 }
コード例 #2
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
                string SlnName = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("SlnName")).Text;
                string Namespace = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Namespace")).Text;
                string RefNamespace = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("RefNamespace")).Text;
                string url = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Url")).Text;
                string gameid = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("gameid")).Text;

                SolutionModel mode = new SolutionModel();
                mode.SlnID = id;
                mode.SlnName = SlnName;
                mode.Namespace = Namespace;
                mode.RefNamespace = RefNamespace;
                mode.Url = url;
                mode.GameID = Convert.ToInt32(gameid);

                SolutionBLL Pinfo = new SolutionBLL();
                if (Pinfo.Update(mode))
                {
                    GridView1.EditIndex = -1;
                    BindData();
                }
            }

            catch (Exception erro)
            {
                Response.Write("错误信息:" + erro.Message);
            }
        }
コード例 #3
0
        protected void butSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                SolutionBLL con = new SolutionBLL();
                SolutionModel model = new SolutionModel();
                model.SlnName = txtDescption.Text.Trim();
                model.Namespace = txtNamespace.Text.Trim();
                model.RefNamespace = txtRefNamespace.Text.Trim();
                model.GameID = Convert.ToInt32(txtGameID.Text);
                model.Url = txtUrl.Text.Trim();
                if (con.Add(model) > 0)
                {
                    Response.Redirect("SolutionsList.aspx");
                }

            }
            catch(Exception ex)
            {
                Page.RegisterStartupScript("", "<script language=javascript>alert('添加失败,填写重复!')</script>");
            }
        }
コード例 #4
0
ファイル: UnitTest.aspx.cs プロジェクト: rongxiong/Scut
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.txtServerUrl.Text = GetCookies(string.Empty);
                if (this.txtServerUrl.Text.Length == 0)
                {
                    this.txtServerUrl.Text = new SolutionBLL().GetUrl(SlnID);
                }
                SolutionModel solutionModel = new SolutionModel();
                this.lbtGmeID.Text = new SolutionBLL().GetGameID(SlnID);

                ddlServerID.Items.Clear();
                DataSet ds = new SolutionBLL().GetServerList(" GameID="+lbtGmeID.Text);
                ddlServerID.DataSource = ds;
                ddlServerID.DataTextField = "ServerName";
                ddlServerID.DataValueField = "ID";
                ddlServerID.DataBind();
                BindContract();
            }
        }
コード例 #5
0
ファイル: SolutionDAL.cs プロジェクト: rongxiong/Scut
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(SolutionModel model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update Solutions set ");
     strSql.Append("SlnName=@SlnName,Namespace=@Namespace,RefNamespace=@RefNamespace,Url=@Url,GameID=@GameID");
     strSql.Append(" where SlnID=@SlnID");
     SqlParameter[] parameters = {
             new SqlParameter("@SlnID", SqlDbType.Int,4),
             new SqlParameter("@SlnName", SqlDbType.VarChar, 0),
             new SqlParameter("@Namespace", SqlDbType.VarChar, 0),
             new SqlParameter("@RefNamespace", SqlDbType.VarChar, 0),
             new SqlParameter("@Url", SqlDbType.VarChar, 0),
             new SqlParameter("@GameID", SqlDbType.Int, 4)
     };
     parameters[0].Value = model.SlnID;
     parameters[1].Value = model.SlnName;
     parameters[2].Value = model.Namespace;
     parameters[3].Value = model.RefNamespace;
     parameters[4].Value = model.Url;
     parameters[5].Value = model.GameID;
     int rows = SqlHelper.ExecuteNonQuery(connectionString,CommandType.Text,strSql.ToString(), parameters);
     if (rows > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
コード例 #6
0
ファイル: SolutionBLL.cs プロジェクト: rongxiong/Scut
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(SolutionModel model)
 {
     return dal.Update(model);
 }
コード例 #7
0
ファイル: SolutionBLL.cs プロジェクト: rongxiong/Scut
 /// <summary>
 /// 添加一条数据
 /// </summary>
 public int Add(SolutionModel model)
 {
     return dal.Add(model);
 }