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

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

            strSql.Append(" AgentID = @AgentID , ");
            strSql.Append(" QyWxPtAppName = @QyWxPtAppName , ");
            strSql.Append(" QyWxPtAppMemo = @QyWxPtAppMemo , ");
            strSql.Append(" DefaultGroupId = @DefaultGroupId , ");
            strSql.Append(" QyWxPtId = @QyWxPtId  ");
            strSql.Append(" where QyWxPtAppId=@QyWxPtAppId ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@QyWxPtAppId",    SqlDbType.Decimal,   9),
                new SqlParameter("@AgentID",        SqlDbType.VarChar,  50),
                new SqlParameter("@QyWxPtAppName",  SqlDbType.VarChar,  50),
                new SqlParameter("@QyWxPtAppMemo",  SqlDbType.VarChar, 250),
                new SqlParameter("@DefaultGroupId", SqlDbType.Decimal,   9),
                new SqlParameter("@QyWxPtId",       SqlDbType.Decimal, 9)
            };

            parameters[0].Value = model.QyWxPtAppId;
            parameters[1].Value = model.AgentID;
            parameters[2].Value = model.QyWxPtAppName;
            parameters[3].Value = model.QyWxPtAppMemo;
            parameters[4].Value = model.DefaultGroupId;
            parameters[5].Value = model.QyWxPtId; try
            {//异常处理
                reCount = this.helper.ExecSqlReInt(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                this.helper.Close();
                throw ex;
            }
            if (reCount <= 0)
            {
                reValue = false;
            }
            return(reValue);
        }
Exemple #2
0
    private void SaveQyWxPtAppInfo()
    {
        BLL.WxBLL            wbll  = new BLL.WxBLL();
        Model.QyWxPtAppModel model = new QyWxPtAppModel();
        model.QyWxPtAppId = ReDecimal("", 0);

        model.AgentID        = ReStr("AgentID", "");
        model.DefaultGroupId = ReDecimal("DefaultGroupId", 0);
        model.QyWxPtAppMemo  = ReStr("QyWxPtAppMemo", "");
        model.QyWxPtAppName  = ReStr("QyWxPtAppName", "");
        model.QyWxPtId       = ReDecimal("QyWxPtId", 0);
        if (model.QyWxPtId == 0)
        {
            throw new Exception("必须确定企业微信平台!");
        }
        wbll.SaveQyWxPtAppInfo(model);
        ReDict2.Add("QyWxPtAppId", model.QyWxPtAppId.ToString());
        ReTrue();
    }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(QyWxPtAppModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CORE.dbo.QyWxPtApp (");
            strSql.Append("AgentID,QyWxPtAppName,QyWxPtAppMemo,DefaultGroupId,QyWxPtId");
            strSql.Append(") values (");
            strSql.Append("@AgentID,@QyWxPtAppName,@QyWxPtAppMemo,@DefaultGroupId,@QyWxPtId");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AgentID",        SqlDbType.VarChar,  50),
                new SqlParameter("@QyWxPtAppName",  SqlDbType.VarChar,  50),
                new SqlParameter("@QyWxPtAppMemo",  SqlDbType.VarChar, 250),
                new SqlParameter("@DefaultGroupId", SqlDbType.Decimal,   9),
                new SqlParameter("@QyWxPtId",       SqlDbType.Decimal, 9)
            };

            parameters[0].Value = model.AgentID;
            parameters[1].Value = model.QyWxPtAppName;
            parameters[2].Value = model.QyWxPtAppMemo;
            parameters[3].Value = model.DefaultGroupId;
            parameters[4].Value = model.QyWxPtId;

            bool result = false;

            try
            {
                model.QyWxPtAppId = decimal.Parse(helper.ExecuteNonQueryBackId(strSql.ToString(), "QyWxPtAppId", parameters));
                result            = true;
            }
            catch (Exception ex)
            {
                this.helper.Close();
                throw ex;
            }
            finally
            {
            }
            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public QyWxPtAppModel GetModel(decimal QyWxPtAppId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select QyWxPtAppId, AgentID, QyWxPtAppName, QyWxPtAppMemo, DefaultGroupId, QyWxPtId  ");
            strSql.Append("  from CORE.dbo.QyWxPtApp ");
            strSql.Append(" where QyWxPtAppId=@QyWxPtAppId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@QyWxPtAppId", SqlDbType.Decimal)
            };
            parameters[0].Value = QyWxPtAppId;


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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["QyWxPtAppId"].ToString() != "")
                {
                    model.QyWxPtAppId = decimal.Parse(ds.Tables[0].Rows[0]["QyWxPtAppId"].ToString());
                }
                model.AgentID       = ds.Tables[0].Rows[0]["AgentID"].ToString();
                model.QyWxPtAppName = ds.Tables[0].Rows[0]["QyWxPtAppName"].ToString();
                model.QyWxPtAppMemo = ds.Tables[0].Rows[0]["QyWxPtAppMemo"].ToString();
                if (ds.Tables[0].Rows[0]["DefaultGroupId"].ToString() != "")
                {
                    model.DefaultGroupId = decimal.Parse(ds.Tables[0].Rows[0]["DefaultGroupId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["QyWxPtId"].ToString() != "")
                {
                    model.QyWxPtId = decimal.Parse(ds.Tables[0].Rows[0]["QyWxPtId"].ToString());
                }

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