Beispiel #1
0
        public bool Modify(userinfoData datuserinfo)
        {
            int  iRel = -1;
            bool bRel = false;

            DataAccess.CommonDB objDB = new DataAccess.CommonDB();
            try
            {
                objDB.OpenConnection();
                string strSql = "update userinfo set subscribe=@subscribe,openid=@openid,nickname=@nickname,sex=@sex,language=@language,city=@city,province=@province,country=@country,headimgurl=@headimgurl,subscribe_time=@subscribe_time,unionid=@unionid,remark=@remark,privilege=@privilege where Id = @Id";
                objDB.Command.CommandType = System.Data.CommandType.Text;
                objDB.Command.CommandText = strSql;
                objDB.Command.Parameters.AddWithValue("@subscribe", datuserinfo.subscribe);
                objDB.Command.Parameters.AddWithValue("@openid", datuserinfo.openid);
                objDB.Command.Parameters.AddWithValue("@nickname", datuserinfo.nickname);
                objDB.Command.Parameters.AddWithValue("@sex", datuserinfo.sex);
                objDB.Command.Parameters.AddWithValue("@language", datuserinfo.language);
                objDB.Command.Parameters.AddWithValue("@city", datuserinfo.city);
                objDB.Command.Parameters.AddWithValue("@province", datuserinfo.province);
                objDB.Command.Parameters.AddWithValue("@country", datuserinfo.country);
                objDB.Command.Parameters.AddWithValue("@headimgurl", datuserinfo.headimgurl);
                objDB.Command.Parameters.AddWithValue("@subscribe_time", datuserinfo.subscribe_time);
                objDB.Command.Parameters.AddWithValue("@unionid", datuserinfo.unionid);
                objDB.Command.Parameters.AddWithValue("@remark", datuserinfo.remark);
                objDB.Command.Parameters.AddWithValue("@privilege", datuserinfo.privilege);
                objDB.Command.Parameters.AddWithValue("@Id", datuserinfo.Id);
                iRel = objDB.Command.ExecuteNonQuery();
            }
            catch (Exception ex)
            { iRel = -1; }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            bRel  = (iRel.Equals(1) ? true : false); return(bRel);
        }
Beispiel #2
0
        public userinfoData[] Select(string Id)
        {
            int iRel = -1;

            DataAccess.CommonDB objDB       = new DataAccess.CommonDB();
            userinfoData[]      datuserinfo = new userinfoData[1];
            string sql = "select * from userinfo where Id= " + Id + " ";

            try
            {
                objDB.OpenConnection();
                DataSet ds = objDB.QueryData(sql, "departmentinfo");
                if (ds.Tables.Count > 0)
                {
                    long nRow = ds.Tables[0].Rows.Count;
                    if (nRow > 0)
                    {
                        datuserinfo = new userinfoData[nRow];
                        for (int i = 0; i < nRow; i++)
                        {
                            datuserinfo[i]                = new userinfoData();
                            datuserinfo[i].subscribe      = ds.Tables[0].Rows[i]["subscribe"].ToString();
                            datuserinfo[i].openid         = ds.Tables[0].Rows[i]["openid"].ToString();
                            datuserinfo[i].nickname       = ds.Tables[0].Rows[i]["nickname"].ToString();
                            datuserinfo[i].sex            = ds.Tables[0].Rows[i]["sex"].ToString();
                            datuserinfo[i].language       = ds.Tables[0].Rows[i]["language"].ToString();
                            datuserinfo[i].city           = ds.Tables[0].Rows[i]["city"].ToString();
                            datuserinfo[i].province       = ds.Tables[0].Rows[i]["province"].ToString();
                            datuserinfo[i].country        = ds.Tables[0].Rows[i]["country"].ToString();
                            datuserinfo[i].headimgurl     = ds.Tables[0].Rows[i]["headimgurl"].ToString();
                            datuserinfo[i].subscribe_time = ds.Tables[0].Rows[i]["subscribe_time"].ToString();
                            datuserinfo[i].unionid        = ds.Tables[0].Rows[i]["unionid"].ToString();
                            datuserinfo[i].remark         = ds.Tables[0].Rows[i]["remark"].ToString();
                            datuserinfo[i].privilege      = ds.Tables[0].Rows[i]["privilege"].ToString();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iRel = -1;
            }
            objDB.CloseConnection();
            objDB.Dispose();
            objDB = null;
            return(datuserinfo);
        }