async void BindNameToLabel() { LoginCredentials c = new LoginCredentials(); PresentationAccessObject p = new PresentationAccessObject(); bool isEmail = await p.IsValidEmailAsync(loginCred), isContact = await p.IsValidContactAsync(loginCred); if(isEmail) { c.EmailAddress = loginCred; c.Contact = string.Empty; } if(isContact) { c.Contact = loginCred; c.EmailAddress = string.Empty; } displayName = await p.NameGiveLoginCredentialAsync(c); DispName.Text = displayName; }
async void BindFirstName() { LoginCredentials l = new LoginCredentials(); string name = string.Empty; PresentationAccessObject p = new PresentationAccessObject(); try { string loginCred = ( string )Session["login"]; bool validContact = await p.IsValidContactAsync(loginCred), validEmail = await p.IsValidEmailAsync(loginCred); if(validEmail) { l.EmailAddress = loginCred; l.Contact = string.Empty; } if(validContact) { l.Contact = loginCred; l.EmailAddress = string.Empty; } name = await p.NameGiveLoginCredentialAsync(l); if (name.Equals(string.Empty)) { lblName.Text = loginCred; } else lblName.Text = name; } catch (Exception ex) { DirectoryInfo d = Directory.CreateDirectory("E:\\Visual Studio Projects\\NKryptor\\ErrorLogs\\WebApp"); FileStream errorLog = File.OpenWrite("E:\\Visual Studio Projects\\NKryptor\\ErrorLogs\\WebApp\\Error.log"); byte[] errorInfo = Encoding.Default.GetBytes(ex.Message + "\n" + ex.StackTrace), time = Encoding.Default.GetBytes("At time (IST) " + DateTime.Now.ToString()), newLn = Encoding.Default.GetBytes(Environment.NewLine); errorLog.Write(time, 0, time.Length); errorLog.Write(newLn, 0, newLn.Length); errorLog.Write(errorInfo, 0, errorInfo.Length); errorLog.Close(); } }