/// <summary> /// 更新一条数据 /// </summary> public void Update(MobileSoft.Model.Unified.Tb_User model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.VarChar, 36), new SqlParameter("@Name", SqlDbType.VarChar, 36), new SqlParameter("@Mobile", SqlDbType.VarChar, 11), new SqlParameter("@Email", SqlDbType.VarChar, 36), new SqlParameter("@QQ", SqlDbType.VarChar, 36), new SqlParameter("@QQToken", SqlDbType.VarChar, 3999), new SqlParameter("@WeChatNum", SqlDbType.VarChar, 36), new SqlParameter("@WeChatToken", SqlDbType.VarChar, 3999), new SqlParameter("@NickName", SqlDbType.VarChar, 36), new SqlParameter("@Pwd", SqlDbType.VarChar, 36), new SqlParameter("@UserPic", SqlDbType.VarChar, 500), new SqlParameter("@Sex", SqlDbType.Bit) }; parameters[0].Value = model.Id; parameters[1].Value = model.Name; parameters[2].Value = model.Mobile; parameters[3].Value = model.Email; parameters[4].Value = model.QQ; parameters[5].Value = model.QQToken; parameters[6].Value = model.WeChatNum; parameters[7].Value = model.WeChatToken; parameters[8].Value = model.NickName; parameters[9].Value = model.Pwd; parameters[10].Value = model.UserPic; parameters[11].Value = model.Sex; DbHelperSQL.RunProcedure("Proc_Tb_User_Update", parameters, out rowsAffected); }
/// <summary> /// 得到一个对象实体 /// </summary> public MobileSoft.Model.Unified.Tb_User GetModel(string Id) { SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.VarChar, 50) }; parameters[0].Value = Id; MobileSoft.Model.Unified.Tb_User model = new MobileSoft.Model.Unified.Tb_User(); DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_User_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { model.Id = ds.Tables[0].Rows[0]["Id"].ToString(); model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); model.Mobile = ds.Tables[0].Rows[0]["Mobile"].ToString(); model.Email = ds.Tables[0].Rows[0]["Email"].ToString(); model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString(); model.QQToken = ds.Tables[0].Rows[0]["QQToken"].ToString(); model.WeChatNum = ds.Tables[0].Rows[0]["WeChatNum"].ToString(); model.WeChatToken = ds.Tables[0].Rows[0]["WeChatToken"].ToString(); model.NickName = ds.Tables[0].Rows[0]["NickName"].ToString(); model.Pwd = ds.Tables[0].Rows[0]["Pwd"].ToString(); model.UserPic = ds.Tables[0].Rows[0]["UserPic"].ToString(); model.Sex = Convert.ToInt32(ds.Tables[0].Rows[0]["Sex"]); model.RegDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["RegDate"]); return(model); } else { return(null); } }