//IDataBase con = new PostgreSQL(); #region 添加用户 /// <summary> /// 添加用户 /// </summary> /// <param name="model"></param> /// <returns></returns> public AjaxMsgResult Add(UC_User model, string CreateUser = null) { result.Success = false; try { if (IsRepeat(model.LoginName, model.Mobile, model.Email) == true) { result.State = AjaxMsgResult.StateEnum.IsExist; result.Msg = "添加失败,存在相同的数据!"; return(result); } if (string.IsNullOrWhiteSpace(model.LoginName) && string.IsNullOrWhiteSpace(model.Mobile) && string.IsNullOrWhiteSpace(model.Email)) { result.State = AjaxMsgResult.StateEnum.VerifyFailed; result.Msg = "添加失败,注册用户名为空!"; return(result); } Dictionary <string, object> dic = new Dictionary <string, object>(); StringBuilder sql = new StringBuilder(); sql.Append(@" INSERT INTO UC_User(Id,UserName,LoginName,PassWord,IsValid,Status,Mobile,CreateUser,CreateTime) VALUES (?Id,?UserName,?LoginName,?PassWord,?IsValid,?Status,?Mobile,?CreateUser,?CreateTime)"); string id = NewData.NewId("YH"); dic.Add("Id", id); dic.Add("UserName", model.UserName); dic.Add("LoginName", model.LoginName); dic.Add("PassWord", Com.SHA512Encrypt(model.PassWord)); dic.Add("IsValid", model.IsValid); dic.Add("Status", model.Status); dic.Add("Mobile", model.Mobile); dic.Add("CreateUser", CreateUser == null? id:model.CreateUser); dic.Add("CreateTime", DateTime.Now); int count = DataBaseFactory.GetDataBase(DataBaseType.main).ExecuteNonQuery(sql.ToString(), dic); if (count == 1) { if (userExtendService.Add(id).Success == true) { result = Verify(model); } } else { result.Msg = "添加失败,请检查数据合法性!"; } } catch (Exception e) { result.Msg = e.ToString(); } return(result); }
public void addTeam() { UC_Team model = new UC_Team() { Id = NewData.NewId("TM"), Name = "Checkmate", Description = "问鼎的第一个团队。", Leader = "YH04eb525ecb64426ea23e209fb7a5982c", CreateTime = DateTime.Now, CreateUser = "******", Sign = "相信自己,坚持走下去!", Logo = "xxx.png", ProjectCount = 0, Status = 1 }; teamService.Add(model); }
/// <summary> /// 注册app /// </summary> /// <param name="model"></param> /// <returns></returns> public AjaxMsgResult Add(UC_AppInfo model) { result.Success = false; Dictionary <string, object> dic = new Dictionary <string, object>(); StringBuilder sql = new StringBuilder(); sql.Append(@" INSERT INTO UC_AppInfo(id,appname,token,description,addressurl,status,createuser,createtime) VALUES (?Id,?AppName,?Token,?Description,?AddressURL,?Status,?CreateUser,?CreateTime)"); model.Id = NewData.NewId("APP"); model.Token = Com.SHA512Encrypt(model.Id + "checkmate"); dic.Add("Id", model.Id); dic.Add("AppName", model.AppName); dic.Add("Token", model.Token); dic.Add("Description", model.Description); dic.Add("AddressURL", model.AddressURL); dic.Add("Status", model.Status); dic.Add("CreateUser", model.CreateUser); dic.Add("CreateTime", DateTime.Now); result.Source = DataBaseFactory.GetDataBase(DataBaseType.main).ExecuteNonQuery(sql.ToString(), dic); if (Convert.ToInt32(result.Source) > 0) { result.Success = true; } return(result); }