private void GetQyWxPtGroupInfo() { Model.QyWxPtGroupModel model = new QyWxPtGroupModel(); BLL.WxBLL wbll = new BLL.WxBLL(); model.QyWxPtGroupId = ReDecimal("QyWxPtGroupId", 0); DataSet ds = wbll.GetQyWxPtGorupInfo(model.QyWxPtGroupId); DataTable dt = ds.Tables[0]; ReDict.Add("info", JsonHelper.ToJsonNo1(dt)); ReTrue(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(QyWxPtGroupModel model) { bool reValue = true; int reCount = 0; StringBuilder strSql = new StringBuilder(); strSql.Append("update CORE.dbo.QyWxPtGroup set "); strSql.Append(" QyWxPtId = @QyWxPtId , "); strSql.Append(" Secret = @Secret , "); strSql.Append(" AccessToken = @AccessToken , "); strSql.Append(" AccessTokenCreateTime = @AccessTokenCreateTime , "); strSql.Append(" QyWxPtGroupMemo = @QyWxPtGroupMemo "); strSql.Append(" where QyWxPtGroupId=@QyWxPtGroupId "); SqlParameter[] parameters = { new SqlParameter("@QyWxPtGroupId", SqlDbType.Decimal, 9), new SqlParameter("@QyWxPtId", SqlDbType.Decimal, 9), new SqlParameter("@Secret", SqlDbType.VarChar, 80), new SqlParameter("@AccessToken", SqlDbType.VarChar, 80), new SqlParameter("@AccessTokenCreateTime", SqlDbType.DateTime), new SqlParameter("@QyWxPtGroupMemo", SqlDbType.VarChar, 250) }; parameters[0].Value = model.QyWxPtGroupId; parameters[1].Value = model.QyWxPtId; parameters[2].Value = model.Secret; parameters[3].Value = model.AccessToken; parameters[4].Value = model.AccessTokenCreateTime; parameters[5].Value = model.QyWxPtGroupMemo; try {//异常处理 reCount = this.helper.ExecSqlReInt(strSql.ToString(), parameters); } catch (Exception ex) { this.helper.Close(); throw ex; } if (reCount <= 0) { reValue = false; } return(reValue); }
private void SaveQyWxPtGroupInfo() { Model.QyWxPtGroupModel model = new QyWxPtGroupModel(); BLL.WxBLL wbll = new BLL.WxBLL(); model.QyWxPtGroupId = ReDecimal("QyWxPtGroupId", 0); if (model.QyWxPtGroupId != 0) { model = wbll.GetQyWxPtGroupModel(model.QyWxPtGroupId); } model.QyWxPtId = ReDecimal("QyWxPtId", 0); model.Secret = ReStr("Secret"); model.QyWxPtGroupMemo = ReStr("QyWxPtGroupMemo"); wbll.SaveQyWxPtGroupInfo(model); ReDict2.Add("QyWxPtGroupId", model.QyWxPtGroupId.ToString()); ReTrue(); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(QyWxPtGroupModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into CORE.dbo.QyWxPtGroup ("); strSql.Append("QyWxPtId,Secret,AccessToken,AccessTokenCreateTime,QyWxPtGroupMemo"); strSql.Append(") values ("); strSql.Append("@QyWxPtId,@Secret,@AccessToken,@AccessTokenCreateTime,@QyWxPtGroupMemo"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@QyWxPtId", SqlDbType.Decimal, 9), new SqlParameter("@Secret", SqlDbType.VarChar, 80), new SqlParameter("@AccessToken", SqlDbType.VarChar, 80), new SqlParameter("@AccessTokenCreateTime", SqlDbType.DateTime), new SqlParameter("@QyWxPtGroupMemo", SqlDbType.VarChar, 250) }; parameters[0].Value = model.QyWxPtId; parameters[1].Value = model.Secret; parameters[2].Value = model.AccessToken; parameters[3].Value = model.AccessTokenCreateTime; parameters[4].Value = model.QyWxPtGroupMemo; bool result = false; try { helper.ExecSqlReInt(strSql.ToString(), parameters); result = true; } catch (Exception ex) { this.helper.Close(); throw ex; } finally { } return(result); }
/// <summary> /// 得到一个对象实体 /// </summary> public QyWxPtGroupModel GetModel(decimal QyWxPtGroupId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select QyWxPtGroupId, QyWxPtId, Secret, AccessToken, AccessTokenCreateTime, QyWxPtGroupMemo "); strSql.Append(" from CORE.dbo.QyWxPtGroup "); strSql.Append(" where QyWxPtGroupId=@QyWxPtGroupId"); SqlParameter[] parameters = { new SqlParameter("@QyWxPtGroupId", SqlDbType.Decimal) }; parameters[0].Value = QyWxPtGroupId; QyWxPtGroupModel model = new QyWxPtGroupModel(); DataSet ds = helper.ExecSqlReDs(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["QyWxPtGroupId"].ToString() != "") { model.QyWxPtGroupId = decimal.Parse(ds.Tables[0].Rows[0]["QyWxPtGroupId"].ToString()); } if (ds.Tables[0].Rows[0]["QyWxPtId"].ToString() != "") { model.QyWxPtId = decimal.Parse(ds.Tables[0].Rows[0]["QyWxPtId"].ToString()); } model.Secret = ds.Tables[0].Rows[0]["Secret"].ToString(); model.AccessToken = ds.Tables[0].Rows[0]["AccessToken"].ToString(); if (ds.Tables[0].Rows[0]["AccessTokenCreateTime"].ToString() != "") { model.AccessTokenCreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["AccessTokenCreateTime"].ToString()); } model.QyWxPtGroupMemo = ds.Tables[0].Rows[0]["QyWxPtGroupMemo"].ToString(); return(model); } else { return(model); } }