Beispiel #1
0
 private void SaveQyWxPtVsUser()
 {
     Model.QyWxPtVsUserModel model = new QyWxPtVsUserModel();
     model.UserId       = ReStr("uid");
     model.QyWxPtId     = ReDecimal("QyWxPtId");
     model.QyWxPtUserId = ReStr("QyWxPtUserId");
     model.Memo         = ReStr("Memo");
     BLL.WxBLL wbll = new BLL.WxBLL();
     wbll.SaveWxPtGroupVsUser(model);
     ReTrue();
 }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(QyWxPtVsUserModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CORE.dbo.QyWxPtVsUser (");
            strSql.Append("UserId,QyWxPtId,QyWxPtUserId,Memo");
            strSql.Append(") values (");
            strSql.Append("@UserId,@QyWxPtId,@QyWxPtUserId,@Memo");
            strSql.Append(") ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@UserId",       SqlDbType.VarChar, 50),
                new SqlParameter("@QyWxPtId",     SqlDbType.Decimal,  9),
                new SqlParameter("@QyWxPtUserId", SqlDbType.VarChar, 80),
                new SqlParameter("@Memo",         SqlDbType.VarChar, 50)
            };

            parameters[0].Value = model.UserId;
            parameters[1].Value = model.QyWxPtId;
            parameters[2].Value = model.QyWxPtUserId;
            parameters[3].Value = model.Memo;

            bool result = false;

            try
            {
                helper.ExecSqlReInt(strSql.ToString(), parameters);
                result = true;
            }
            catch (Exception ex)
            {
                this.helper.Close();
                throw ex;
            }
            finally
            {
            }
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(QyWxPtVsUserModel model)
        {
            bool          reValue = true;
            int           reCount = 0;
            StringBuilder strSql  = new StringBuilder();

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

            strSql.Append(" UserId = @UserId , ");
            strSql.Append(" QyWxPtId = @QyWxPtId , ");
            strSql.Append(" QyWxPtUserId = @QyWxPtUserId , ");
            strSql.Append(" Memo = @Memo  ");
            strSql.Append(" where UserId=@UserId and QyWxPtId=@QyWxPtId  ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@UserId",       SqlDbType.VarChar, 50),
                new SqlParameter("@QyWxPtId",     SqlDbType.Decimal,  9),
                new SqlParameter("@QyWxPtUserId", SqlDbType.VarChar, 80),
                new SqlParameter("@Memo",         SqlDbType.VarChar, 50)
            };

            parameters[0].Value = model.UserId;
            parameters[1].Value = model.QyWxPtId;
            parameters[2].Value = model.QyWxPtUserId;
            parameters[3].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);
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public QyWxPtVsUserModel GetModel(string UserId, decimal QyWxPtId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select UserId, QyWxPtId, QyWxPtUserId, Memo  ");
            strSql.Append("  from CORE.dbo.QyWxPtVsUser ");
            strSql.Append(" where UserId=@UserId and QyWxPtId=@QyWxPtId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserId",   SqlDbType.VarChar, 50),
                new SqlParameter("@QyWxPtId", SqlDbType.Decimal, 9)
            };
            parameters[0].Value = UserId;
            parameters[1].Value = QyWxPtId;


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

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.UserId = ds.Tables[0].Rows[0]["UserId"].ToString();
                if (ds.Tables[0].Rows[0]["QyWxPtId"].ToString() != "")
                {
                    model.QyWxPtId = decimal.Parse(ds.Tables[0].Rows[0]["QyWxPtId"].ToString());
                }
                model.QyWxPtUserId = ds.Tables[0].Rows[0]["QyWxPtUserId"].ToString();
                model.Memo         = ds.Tables[0].Rows[0]["Memo"].ToString();

                return(model);
            }
            else
            {
                return(model);
            }
        }