public string Register(string _ParentId, string _UserGroup, string _UserName, string _Password, string _Point) { using (DbOperHandler dbOperHandler = new ComData().Doh()) { dbOperHandler.Reset(); dbOperHandler.SqlCmd = "SELECT Id FROM [N_User] WHERE [UserName]='" + _UserName.ToLower() + "'"; if (dbOperHandler.GetDataTable().Rows.Count > 0) { return(this.GetJsonResult(0, "账号已存在,请更换一个账号!")); } string str = MD5.Last64(MD5.Lower32(_Password)); object[,] _vFields1 = new object[2, 6] { { "ParentId", "UserGroup", "UserName", "Password", "Point", "PayPass" }, { _ParentId, _UserGroup, _UserName.ToLower(), str, _Point, MD5.Last64(MD5.Lower32("123456")) } }; dbOperHandler.Reset(); dbOperHandler.AddFieldItems(_vFields1); int num = dbOperHandler.Insert("N_User"); if (num <= 0) { return(this.GetJsonResult(0, "添加会员失败!")); } dbOperHandler.Reset(); dbOperHandler.ConditionExpress = "id=@id"; dbOperHandler.AddConditionParameter("@id", (object)_ParentId); object field = dbOperHandler.GetField("N_User", "UserCode"); dbOperHandler.Reset(); dbOperHandler.ConditionExpress = "id=" + (object)num; dbOperHandler.AddFieldItem("UserCode", (object)(field.ToString() + Strings.PadLeft(num.ToString()))); dbOperHandler.Update("N_User"); object[,] _vFields2 = new object[2, 2] { { "UserId", "Change" }, { num, 0 } }; dbOperHandler.Reset(); dbOperHandler.AddFieldItems(_vFields2); dbOperHandler.Insert("N_UserMoneyStatAll"); return(this.GetJsonResult(1, "添加会员成功!")); } }
public string Register(string _ParentId, string _UserGroup, string _UserName, string _Password, string _Point) { string jsonResult; using (DbOperHandler dbOperHandler = new ComData().Doh()) { dbOperHandler.Reset(); dbOperHandler.SqlCmd = "SELECT Id FROM [N_User] WHERE [UserName]='" + _UserName.ToLower() + "'"; if (dbOperHandler.GetDataTable().Rows.Count > 0) { jsonResult = base.GetJsonResult(0, "账号已存在,请更换一个账号!"); } else { string text = MD5.Last64(MD5.Lower32(_Password)); object[,] array = new object[2, 6]; array[0, 0] = "ParentId"; array[0, 1] = "UserGroup"; array[0, 2] = "UserName"; array[0, 3] = "Password"; array[0, 4] = "Point"; array[0, 5] = "PayPass"; array[1, 0] = _ParentId; array[1, 1] = _UserGroup; array[1, 2] = _UserName.ToLower(); array[1, 3] = text; array[1, 4] = _Point; array[1, 5] = MD5.Last64(MD5.Lower32("123456")); object[,] vFields = array; dbOperHandler.Reset(); dbOperHandler.AddFieldItems(vFields); int num = dbOperHandler.Insert("N_User"); if (num > 0) { dbOperHandler.Reset(); dbOperHandler.ConditionExpress = "id=@id"; dbOperHandler.AddConditionParameter("@id", _ParentId); object field = dbOperHandler.GetField("N_User", "UserCode"); dbOperHandler.Reset(); dbOperHandler.ConditionExpress = "id=" + num; dbOperHandler.AddFieldItem("UserCode", field + Strings.PadLeft(num.ToString())); dbOperHandler.Update("N_User"); object[,] array2 = new object[2, 2]; array2[0, 0] = "UserId"; array2[0, 1] = "Change"; array2[1, 0] = num; array2[1, 1] = 0; object[,] vFields2 = array2; dbOperHandler.Reset(); dbOperHandler.AddFieldItems(vFields2); dbOperHandler.Insert("N_UserMoneyStatAll"); jsonResult = base.GetJsonResult(1, "添加会员成功!"); } else { jsonResult = base.GetJsonResult(0, "添加会员失败!"); } } } return(jsonResult); }