public ActionResult Registered(RegisteredDataModels _RegisteredDM) { //return Dictionary <string, string> _JsonDictionary = new Dictionary <string, string>(); var EmailCheck = DataCheckLibrary.IsValidEMailAddress(_RegisteredDM.UserAccount); var ReCheckPassword = DataCheckLibrary.RecheckPassword(_RegisteredDM.Password, _RegisteredDM.ConfirmPassword, 8); if (EmailCheck.ContainsKey(false)) { _JsonDictionary.Add("Email", EmailCheck[false]); } if (ReCheckPassword.ContainsKey(false)) { _JsonDictionary.Add("Pwd", ReCheckPassword[false]); } if (_JsonDictionary.Count > 0) { var FormatJson = FormatLibrary.DictionaryToJson(_JsonDictionary); return(Content(FormatJson, JsonContentType)); } else { _db.Local_Account.Add(new Local_Account { Account_Guid = _RegisteredDM.Account_Guid, UserAccount = _RegisteredDM.UserAccount, Password = _RegisteredDM.Password, EmailCheck = false }); _db.SaveChanges(); } return(Content("")); }
public MessageList DeSerialize(string data, enmMessageFormat format) { FormatLibrary fl = new FormatLibrary(); return fl.DeSerialize<MessageList>(data, format); }
// Main read messages method, as much of this is similar we have created a generic private method which all public methods call private string Read(enmReadType readType, string clientId, string sessionId, enmMessageFormat format, int maxNumber) { Log(clientId, sessionId, format, maxNumber); string formatted = ""; try { UserContainer user = _userProcessor.GetUser(clientId, sessionId, null); if (user == null) throw new InitException(); try { MessageList messages = null; switch (readType) { case enmReadType.ReadNext: messages = _messageProcessor.Read(enmReadDirection.Forward, clientId, sessionId, maxNumber); break; case enmReadType.ReadLast: messages = _messageProcessor.Read(enmReadDirection.Backward, clientId, sessionId, maxNumber); break; } FormatLibrary fl = new FormatLibrary(); formatted = fl.Serialize(messages, format); } catch (TrappedException ex) { Log(ex); _messageProcessor.Create(clientId, sessionId, Config.ClientId, enmMessageCategory.TrappedException, ex.Message, ex.MetaData); } } catch (InitException) { Log(); } catch (Exception ex) { Log(ex); _messageProcessor.Create(clientId, sessionId, Config.ClientId, enmMessageCategory.Exception, ex.Message); } return formatted; }