Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(QyWxPtModel model)
        {
            bool          reValue = true;
            int           reCount = 0;
            StringBuilder strSql  = new StringBuilder();

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

            strSql.Append(" CorpId = @CorpId , ");
            strSql.Append(" QyWxPtName = @QyWxPtName , ");
            strSql.Append(" CreateTime = @CreateTime , ");
            strSql.Append(" QyWxPtMemo = @QyWxPtMemo , ");
            strSql.Append(" MerId = @MerId , ");
            strSql.Append(" OrderNo = @OrderNo  ");
            strSql.Append(" where QyWxPtId=@QyWxPtId ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@QyWxPtId",   SqlDbType.Decimal,     9),
                new SqlParameter("@CorpId",     SqlDbType.VarChar,    50),
                new SqlParameter("@QyWxPtName", SqlDbType.VarChar,    50),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@QyWxPtMemo", SqlDbType.VarChar,   250),
                new SqlParameter("@MerId",      SqlDbType.Decimal,     9),
                new SqlParameter("@OrderNo",    SqlDbType.Int, 4)
            };

            parameters[0].Value = model.QyWxPtId;
            parameters[1].Value = model.CorpId;
            parameters[2].Value = model.QyWxPtName;
            parameters[3].Value = model.CreateTime;
            parameters[4].Value = model.QyWxPtMemo;
            parameters[5].Value = model.MerId;
            parameters[6].Value = model.OrderNo; try
            {//异常处理
                reCount = this.helper.ExecSqlReInt(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                this.helper.Close();
                throw ex;
            }
            if (reCount <= 0)
            {
                reValue = false;
            }
            return(reValue);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public QyWxPtModel GetModel(decimal QyWxPtId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select QyWxPtId, CorpId, QyWxPtName, CreateTime, QyWxPtMemo, MerId, OrderNo  ");
            strSql.Append("  from CORE.dbo.QyWxPt ");
            strSql.Append(" where QyWxPtId=@QyWxPtId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@QyWxPtId", SqlDbType.Decimal)
            };
            parameters[0].Value = QyWxPtId;


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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["QyWxPtId"].ToString() != "")
                {
                    model.QyWxPtId = decimal.Parse(ds.Tables[0].Rows[0]["QyWxPtId"].ToString());
                }
                model.CorpId     = ds.Tables[0].Rows[0]["CorpId"].ToString();
                model.QyWxPtName = ds.Tables[0].Rows[0]["QyWxPtName"].ToString();
                if (ds.Tables[0].Rows[0]["CreateTime"].ToString() != "")
                {
                    model.CreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["CreateTime"].ToString());
                }
                model.QyWxPtMemo = ds.Tables[0].Rows[0]["QyWxPtMemo"].ToString();
                if (ds.Tables[0].Rows[0]["MerId"].ToString() != "")
                {
                    model.MerId = decimal.Parse(ds.Tables[0].Rows[0]["MerId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderNo"].ToString() != "")
                {
                    model.OrderNo = int.Parse(ds.Tables[0].Rows[0]["OrderNo"].ToString());
                }

                return(model);
            }
            else
            {
                return(model);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(QyWxPtModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CORE.dbo.QyWxPt (");
            strSql.Append("CorpId,QyWxPtName,CreateTime,QyWxPtMemo,MerId,OrderNo");
            strSql.Append(") values (");
            strSql.Append("@CorpId,@QyWxPtName,@CreateTime,@QyWxPtMemo,@MerId,@OrderNo");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CorpId",     SqlDbType.VarChar,    50),
                new SqlParameter("@QyWxPtName", SqlDbType.VarChar,    50),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@QyWxPtMemo", SqlDbType.VarChar,   250),
                new SqlParameter("@MerId",      SqlDbType.Decimal,     9),
                new SqlParameter("@OrderNo",    SqlDbType.Int, 4)
            };

            parameters[0].Value = model.CorpId;
            parameters[1].Value = model.QyWxPtName;
            parameters[2].Value = model.CreateTime;
            parameters[3].Value = model.QyWxPtMemo;
            parameters[4].Value = model.MerId;
            parameters[5].Value = model.OrderNo;

            bool result = false;

            try
            {
                helper.ExecSqlReInt(strSql.ToString(), parameters);
                result = true;
            }
            catch (Exception ex)
            {
                this.helper.Close();
                throw ex;
            }
            finally
            {
            }
            return(result);
        }
Ejemplo n.º 4
0
    private void SaveQyWxPtInfo()
    {
        BLL.WxBLL         wbll  = new BLL.WxBLL();
        Model.QyWxPtModel model = new QyWxPtModel();
        model.QyWxPtId = ReDecimal("QyWxPtId", 0);
        if (model.QyWxPtId != 0)
        {
            model = wbll.GetQyWxPtModel(model.QyWxPtId);
        }
        model.CorpId  = ReStr("CorpId", "");
        model.MerId   = ReDecimal("MerId", 0);
        model.OrderNo = ReInt("OrderNo", 1);

        model.QyWxPtMemo = ReStr("QyWxPtMemo", "");
        model.QyWxPtName = ReStr("QyWxPtName", "");


        wbll.SaveQyWxPtInfo(model);
        ReTrue();
    }