public void TypeCipher() { for (int i = 0; i < LastRusSmallWord; i++) { ciph[i] = new Models.Cipher(); } Models.Context contx = new Models.Context(); for (int i = 1; i < LastRusSmallWord + 1; i++) { ciph[i - 1].Id = i; ciph[i - 1].oldSymbolId = ((FirstRusBigWord + i - 1)); int place = FirstRusBigWord + i + 6; if (place > LastRusSmallWord) { place = place - 64; } ciph[i - 1].newSymbol = ((char)place).ToString(); contx.CipherTable.Add(ciph[i - 1]); } contx.SaveChanges(); Models.Context test = new Models.Context(); Models.Cipher temp = new Models.Cipher(); foreach (Models.Cipher a in test.CipherTable) { temp = a; } }
public ViewResult RsvpForm(MvcApplication1.Models.MessageFromClient client) { Models.Context test = new Models.Context(); Models.Cipher temp = new Models.Cipher(); //TypeCipher(); foreach (Models.Cipher a in test.CipherTable) { temp = a; } int hour = DateTime.Now.Hour; int min = DateTime.Now.Minute; int sec = DateTime.Now.Second; int moun = DateTime.Now.Month; int year = DateTime.Now.Year; string time = hour.ToString() + ":" + min.ToString() + ":" + sec.ToString() + ":" + moun.ToString() + ":" + year.ToString(); // ViewBag.Greeting = time; client.Time = time; if (ModelState.IsValid) { Models.Context contx = new Models.Context(); string code = ""; code = ToDoCode(client.Message); ViewBag.Greeting = code; contx.DateMessage.Add(client); contx.SaveChanges(); int index = 0; List <string> allcipher = new List <string>(); List <string> alltime = new List <string>(); foreach (Models.MessageFromClient c in contx.DateMessage) { var k = c; allcipher.Add(ToDoCode(k.Message)); alltime.Add(k.Time); } ViewBag.AllCipher = allcipher; ViewBag.AllTime = alltime; return(View("Thanks", client)); } else { return(View()); } }
public AutofillCipher(Models.Cipher cipher, IAppSettingsService appSettings, bool fuzzy = false) : base(cipher, appSettings) { Fuzzy = fuzzy; }
public Cipher(Models.Cipher cipher, IAppSettingsService appSettings) { CipherModel = cipher; Id = cipher.Id; Shared = !string.IsNullOrWhiteSpace(cipher.OrganizationId); HasAttachments = cipher.Attachments?.Any() ?? false; FolderId = cipher.FolderId; Name = cipher.Name?.Decrypt(cipher.OrganizationId); Type = cipher.Type; if (string.IsNullOrWhiteSpace(Name) || Name.Length == 0) { NameGroup = "-"; } else if (Char.IsLetter(Name[0])) { NameGroup = Name[0].ToString(); } else if (Char.IsDigit(Name[0])) { NameGroup = "#"; } else { NameGroup = "-"; } switch (cipher.Type) { case CipherType.Login: LoginUsername = cipher.Login?.Username?.Decrypt(cipher.OrganizationId) ?? " "; LoginUri = cipher.Login.Uris?.FirstOrDefault()?.Uri?.Decrypt(cipher.OrganizationId) ?? " "; LoginPassword = new Lazy <string>(() => cipher.Login?.Password?.Decrypt(cipher.OrganizationId)); LoginTotp = new Lazy <string>(() => cipher.Login?.Totp?.Decrypt(cipher.OrganizationId)); Icon = "login.png"; var hostnameUri = LoginUri; var isWebsite = false; var imageEnabled = !appSettings.DisableWebsiteIcons; if (hostnameUri.StartsWith("androidapp://")) { Icon = "android.png"; } else if (hostnameUri.StartsWith("iosapp://")) { Icon = "apple.png"; } else if (imageEnabled && !hostnameUri.Contains("://") && hostnameUri.Contains(".")) { hostnameUri = $"http://{hostnameUri}"; isWebsite = true; } else if (imageEnabled) { isWebsite = hostnameUri.StartsWith("http") && hostnameUri.Contains("."); } if (imageEnabled && isWebsite && Uri.TryCreate(hostnameUri, UriKind.Absolute, out Uri u)) { var iconsUrl = appSettings.IconsUrl; if (string.IsNullOrWhiteSpace(iconsUrl)) { if (!string.IsNullOrWhiteSpace(appSettings.BaseUrl)) { iconsUrl = $"{appSettings.BaseUrl}/icons"; } else { iconsUrl = "https://icons.bitwarden.net"; } } Icon = $"{iconsUrl}/{u.Host}/icon.png"; } Subtitle = LoginUsername; break; case CipherType.SecureNote: Icon = "note.png"; Subtitle = " "; break; case CipherType.Card: CardNumber = cipher.Card?.Number?.Decrypt(cipher.OrganizationId) ?? " "; var cardBrand = cipher.Card?.Brand?.Decrypt(cipher.OrganizationId) ?? " "; CardCode = new Lazy <string>(() => cipher.Card?.Code?.Decrypt(cipher.OrganizationId)); Icon = "card.png"; Subtitle = cardBrand; if (!string.IsNullOrWhiteSpace(CardNumber) && CardNumber.Length >= 4) { if (!string.IsNullOrWhiteSpace(CardNumber)) { Subtitle += ", "; } Subtitle += ("*" + CardNumber.Substring(CardNumber.Length - 4)); } break; case CipherType.Identity: var firstName = cipher.Identity?.FirstName?.Decrypt(cipher.OrganizationId) ?? " "; var lastName = cipher.Identity?.LastName?.Decrypt(cipher.OrganizationId) ?? " "; Icon = "id.png"; Subtitle = " "; if (!string.IsNullOrWhiteSpace(firstName)) { Subtitle = firstName; } if (!string.IsNullOrWhiteSpace(lastName)) { if (!string.IsNullOrWhiteSpace(Subtitle)) { Subtitle += " "; } Subtitle += lastName; } break; default: break; } }