コード例 #1
0
ファイル: ContractDAL.cs プロジェクト: dongliang/Scut
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(model.ContractModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Contract(");
            strSql.Append("ID,Descption,ParentID,SlnID,Complated,AgreementID)");
            strSql.Append(" values (");
            strSql.Append("@ID,@Descption,@ParentID,@SlnID,@Complated,@AgreementID)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",          SqlDbType.Int,       4),
                new SqlParameter("@Descption",   SqlDbType.VarChar, 100),
                new SqlParameter("@ParentID",    SqlDbType.Int,       4),
                new SqlParameter("@SlnID",       SqlDbType.Int,       4),
                new SqlParameter("@Complated",   SqlDbType.Bit,       0),
                new SqlParameter("@AgreementID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.Descption;
            parameters[2].Value = model.ParentID;
            parameters[3].Value = model.SlnID;
            parameters[4].Value = model.Complated;
            parameters[5].Value = model.AgreementID;
            int rows = SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: UpParamInfo.aspx.cs プロジェクト: rongxiong/Scut
 protected void butSubmit_Click(object sender, EventArgs e)
 {
     ContractBLL BLL = new ContractBLL();
     ContractModel model = new ContractModel();
     model.ID = ContractID;
     model.SlnID = SlnID;
     model.Descption = txtDescption.Text.Trim();
     model.AgreementID = Convert.ToInt32(ddlAgreement.SelectedValue);
     if (BLL.Update(model))
     {
         Response.Write("<script language=javascript>alert('修改成功!')</script>");
     }
 }
コード例 #3
0
ファイル: UpParamInfo.aspx.cs プロジェクト: rongxiong/Scut
        /// <summary>
        /// 初始化加载
        /// </summary>
        public void Bind()
        {
            ddlAgreement.Items.Clear();
            DataSet ds = SlnID == 0 ? new AgreementBLL().GetList("", "0") : new AgreementBLL().GetList(" gameid=" + SlnID, SlnID.ToString());
            ddlAgreement.DataSource = ds;
            ddlAgreement.DataTextField = "Title";
            ddlAgreement.DataValueField = "AgreementID";
            ddlAgreement.DataBind();

            if (ddlAgreement.Items.Count == 0)
            {
                ddlAgreement.Items.Add(new ListItem("无接口分类", "0"));
            }
            if (!Request.QueryString["ID"].Equals(""))
            {
                int ID = Convert.ToInt32(Request.QueryString["ID"]);
                int slnID = Convert.ToInt32(Request.QueryString["slnID"]);
                ContractBLL BLL = new ContractBLL();
                ContractModel model = new ContractModel();
                model = BLL.GetModel(ContractID, SlnID);
                txtDescption.Text = model.Descption;
                ddlAgreement.SelectedValue = model.AgreementID.ToString();
            }
        }
コード例 #4
0
        protected void butSubmit_Click(object sender, EventArgs e)
        {
            try
            {

                ContractBLL con = new ContractBLL();
                ContractModel model = new ContractModel();
                model.ID = Convert.ToInt32(txtID.Text.Trim());
                model.Descption = txtDescption.Text.Trim();
                model.ParentID = 1;
                model.SlnID = SlnID;
                //model.AgreementID = Convert.ToInt32(ddlAgreement.SelectedValue);
                if (con.Add(model))
                {
                    Response.Redirect(String.Format("index.aspx?ID={0}&slnID={1}", model.ID, model.SlnID));
                    return;
                }

            }
            catch(Exception ex)
            {
                Page.RegisterStartupScript("", "<script language=javascript>alert('添加失败,填写重复!')</script>");
            }
        }
コード例 #5
0
ファイル: ContractDAL.cs プロジェクト: rongxiong/Scut
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ContractModel model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update Contract set ");
     strSql.Append("Descption=@Descption,");
     strSql.Append("ParentID=@ParentID,");
     strSql.Append("AgreementID=@AgreementID");
     strSql.Append(" where ID=@ID and SlnID=@SlnID ");
     SqlParameter[] parameters = {
             new SqlParameter("@Descption", SqlDbType.VarChar,100),
             new SqlParameter("@ParentID", SqlDbType.Int,4),
             new SqlParameter("@ID", SqlDbType.Int,4),
             new SqlParameter("@SlnID", SqlDbType.Int,4),
                 new SqlParameter("@AgreementID", SqlDbType.Int,4)};
     parameters[0].Value = model.Descption;
     parameters[1].Value = model.ParentID;
     parameters[2].Value = model.ID;
     parameters[3].Value = model.SlnID;
     parameters[4].Value = model.AgreementID;
     int rows = SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, strSql.ToString(), parameters);
     if (rows > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
コード例 #6
0
ファイル: ContractDAL.cs プロジェクト: rongxiong/Scut
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ContractModel GetModel(int ID, int SlnID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 ID,Descption,ParentID,SlnID,Complated,AgreementID from Contract ");
            strSql.Append(" where ID=@ID and SlnID=@SlnID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4),
                    new SqlParameter("@SlnID", SqlDbType.Int,4)};
            parameters[0].Value = ID;
            parameters[1].Value = SlnID;

            ContractModel model = new ContractModel();
            DataSet ds = SqlHelper.ExecuteDataset(connectionString, CommandType.Text, strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                var row = ds.Tables[0].Rows[0];
                if (row["ID"] != null && row["ID"].ToString() != "")
                {
                    model.ID = int.Parse(row["ID"].ToString());
                }
                if (row["SlnID"] != null && row["SlnID"].ToString() != "")
                {
                    model.SlnID = int.Parse(row["SlnID"].ToString());
                }
                if (row["Descption"] != null && row["Descption"].ToString() != "")
                {
                    model.Descption = row["Descption"].ToString();
                }
                if (row["ParentID"] != null && row["ParentID"].ToString() != "")
                {
                    model.ParentID = int.Parse(row["ParentID"].ToString());
                }
                if (row["Complated"] != null && row["Complated"].ToString() != "")
                {
                    model.Complated = bool.Parse(row["Complated"].ToString());
                }
                if (row["AgreementID"] != null && row["AgreementID"].ToString() != "")
                {
                    model.AgreementID = int.Parse(row["AgreementID"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
コード例 #7
0
ファイル: ContractBLL.cs プロジェクト: rongxiong/Scut
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ContractModel model)
 {
     return dal.Update(model);
 }
コード例 #8
0
ファイル: ContractBLL.cs プロジェクト: rongxiong/Scut
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Add(ContractModel model)
 {
     return dal.Add(model);
 }