public Model mappingRow(System.Data.DataRow rs) { UserModel umd = new UserModel(rs["userid"].ToString(),DbInit.CorpID, rs["username"].ToString(), rs["usersex"].ToString(), rs["rolename"].ToString(), rs["rightbit"].ToString()); return umd; }
public JArray processer(string jsonStr) { String userID = null; String userPwd = null; JArray jsa = JArray.Parse(jsonStr); JObject json = JObject.Parse(jsa[0].ToString()); userID = json["userID"].ToString(); userPwd = json["userPwd"].ToString(); UserDao ud = new UserDao(); UserModel userModel = ud.login(userID, userPwd); JArray jsonArray = new JArray(); JObject jsonObject = new JObject(); if (userModel == null) { userModel = new UserModel("_", "_","_", "_", "_", "_"); jsonObject = new UserRowMapper().mappingRow(userModel); jsonObject.Add("isok", "密码错误或用户名不存在"); } else { if (new CreateTableDao().create(userID)) { jsonObject = new UserRowMapper().mappingRow(userModel); jsonObject.Add("isok", "true"); } else { userModel = new UserModel("_","_", "_", "_", "_", "_"); jsonObject = new UserRowMapper().mappingRow(userModel); jsonObject.Add("isok", "您的数据没有初始化,请首先在电脑端登陆一次.");// 没有初始化表 } } jsonArray.Add(jsonObject); return jsonArray; }