public int AddUser(WX_USER_INFO model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into [WX_USER_INFO] ("); strSql.Append("OPEN_ID,USER_CODE,NICK_NAME,SEX,CITY,COUNTRY,HEAD_IMG_URL,SUBSCRIBE,SUBSCRIBE_TIME,REMARK,GROUPID,USER_PHONE,PROVINCE,LANGUAGE,RMRK3)"); strSql.Append(" values ("); strSql.Append("@OPEN_ID,@USER_CODE,@NICK_NAME,@SEX,@CITY,@COUNTRY,@HEAD_IMG_URL,@SUBSCRIBE,@SUBSCRIBE_TIME,@REMARK,@GROUPID,@USER_PHONE,@PROVINCE,@LANGUAGE,@RMRK3)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@OPEN_ID", SqlDbType.VarChar, 32), new SqlParameter("@USER_CODE", SqlDbType.VarChar, 32), new SqlParameter("@NICK_NAME", SqlDbType.VarChar, 32), new SqlParameter("@SEX", SqlDbType.Int, 4), new SqlParameter("@CITY", SqlDbType.VarChar, 32), new SqlParameter("@COUNTRY", SqlDbType.VarChar, 32), new SqlParameter("@HEAD_IMG_URL", SqlDbType.VarChar, -1), new SqlParameter("@SUBSCRIBE", SqlDbType.Int, 4), new SqlParameter("@SUBSCRIBE_TIME", SqlDbType.VarChar, 32), new SqlParameter("@REMARK", SqlDbType.VarChar, 32), new SqlParameter("@GROUPID", SqlDbType.Int, 4), new SqlParameter("@USER_PHONE", SqlDbType.VarChar, 32), new SqlParameter("@PROVINCE", SqlDbType.VarChar, 128), new SqlParameter("@LANGUAGE", SqlDbType.VarChar, 128), new SqlParameter("@RMRK3", SqlDbType.VarChar, 128) }; parameters[0].Value = OPEN_ID; parameters[1].Value = USER_CODE; parameters[2].Value = NICK_NAME; parameters[3].Value = SEX; parameters[4].Value = CITY; parameters[5].Value = COUNTRY; parameters[6].Value = HEAD_IMG_URL; parameters[7].Value = SUBSCRIBE; parameters[8].Value = SUBSCRIBE_TIME; parameters[9].Value = REMARK; parameters[10].Value = GROUPID; parameters[11].Value = USER_PHONE; parameters[12].Value = PROVINCE; parameters[13].Value = LANGUAGE; parameters[14].Value = RMRK3; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
public static TUserInfo getUserInfo(WX_USER_INFO wxUser1) { TUserInfo user1 = new TUserInfo(); if (!string.IsNullOrEmpty(wxUser1.User_id)) { user1.User_id = Guid.Parse(wxUser1.User_id); user1.Token = getToken(wxUser1.User_id); } user1.Openid = wxUser1.Openid; //user1.SUBSCRIBE = Int32.Parse(subscribe); user1.Nick_name = wxUser1.Nick_name; if (wxUser1.Sex != 0) { user1.Gender = Convert.ToString(wxUser1.Sex);// Int32.Parse(sex); } //user1.LANGUAGE = language; user1.City = wxUser1.City; //user1.City_id = 36; user1.Province = wxUser1.Province; //user1.Province_id = "1"; //user1.COUNTRY = country; user1.Head_img_url = wxUser1.Head_img_url; //user1.SUBSCRIBE_TIME = subscribe_time; //user1.REMARK = remark; if (!string.IsNullOrEmpty(wxUser1.Sc) && wxUser1.Sc != "999") { user1.Sc_id = ScHelper.getSc(wxUser1.Sc); TscWxInfo scinfo1 = BLLTable <TscWxInfo> .GetRowData(TscWxInfo.Attribute.Sc_id, user1.Sc_id); if (scinfo1 != null && scinfo1.IsNotNull()) { user1.School_id = scinfo1.School_id; user1.School_name = scinfo1.Sc_name; } } return(user1); }