示例#1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ShouCangProModel model)
        {
            bool          reValue = true;
            int           reCount = 0;
            StringBuilder strSql  = new StringBuilder();

            strSql.Append("update CORE.dbo.ShouCangPro set ");

            strSql.Append(" CreateTime = @CreateTime , ");
            strSql.Append(" MemberId = @MemberId , ");
            strSql.Append(" ProId = @ProId , ");
            strSql.Append(" OrderNo = @OrderNo , ");
            strSql.Append(" Memo = @Memo  ");
            strSql.Append(" where ShouCangId=@ShouCangId ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@ShouCangId", SqlDbType.Decimal,    9),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@MemberId",   SqlDbType.Decimal,    9),
                new SqlParameter("@ProId",      SqlDbType.VarChar,   50),
                new SqlParameter("@OrderNo",    SqlDbType.Int,        4),
                new SqlParameter("@Memo",       SqlDbType.VarChar, 500)
            };

            parameters[0].Value = model.ShouCangId;
            parameters[1].Value = model.CreateTime;
            parameters[2].Value = model.MemberId;
            parameters[3].Value = model.ProId;
            parameters[4].Value = model.OrderNo;
            parameters[5].Value = model.Memo; try
            {//异常处理
                reCount = this.helper.ExecSqlReInt(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                this.helper.Close();
                throw ex;
            }
            if (reCount <= 0)
            {
                reValue = false;
            }
            return(reValue);
        }
示例#2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ShouCangProModel GetModel(decimal ShouCangId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ShouCangId, CreateTime, MemberId, ProId, OrderNo, Memo  ");
            strSql.Append("  from CORE.dbo.ShouCangPro ");
            strSql.Append(" where ShouCangId=@ShouCangId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ShouCangId", SqlDbType.Decimal)
            };
            parameters[0].Value = ShouCangId;


            ShouCangProModel model = new ShouCangProModel();
            DataSet          ds    = helper.ExecSqlReDs(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ShouCangId"].ToString() != "")
                {
                    model.ShouCangId = decimal.Parse(ds.Tables[0].Rows[0]["ShouCangId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateTime"].ToString() != "")
                {
                    model.CreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["CreateTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MemberId"].ToString() != "")
                {
                    model.MemberId = decimal.Parse(ds.Tables[0].Rows[0]["MemberId"].ToString());
                }
                model.ProId = ds.Tables[0].Rows[0]["ProId"].ToString();
                if (ds.Tables[0].Rows[0]["OrderNo"].ToString() != "")
                {
                    model.OrderNo = int.Parse(ds.Tables[0].Rows[0]["OrderNo"].ToString());
                }
                model.Memo = ds.Tables[0].Rows[0]["Memo"].ToString();

                return(model);
            }
            else
            {
                return(model);
            }
        }
示例#3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(ShouCangProModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CORE.dbo.ShouCangPro (");
            strSql.Append("CreateTime,MemberId,ProId,OrderNo,Memo");
            strSql.Append(") values (");
            strSql.Append("@CreateTime,@MemberId,@ProId,@OrderNo,@Memo");
            strSql.Append(") ");
            strSql.Append(";");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@MemberId",   SqlDbType.Decimal,    9),
                new SqlParameter("@ProId",      SqlDbType.VarChar,   50),
                new SqlParameter("@OrderNo",    SqlDbType.Int,        4),
                new SqlParameter("@Memo",       SqlDbType.VarChar, 500)
            };

            parameters[0].Value = model.CreateTime;
            parameters[1].Value = model.MemberId;
            parameters[2].Value = model.ProId;
            parameters[3].Value = model.OrderNo;
            parameters[4].Value = model.Memo;

            bool result = false;

            try
            {
                model.ShouCangId = decimal.Parse(helper.ExecuteNonQueryBackId(strSql.ToString(), "ShouCangId", parameters));


                result = true;
            }
            catch (Exception ex)
            {
                this.helper.Close();
                throw ex;
            }
            finally
            {
            }
            return(result);
        }