public IResponse <NoValue> AddKeyAccount(KeyAccountCreateModel createModel) { Logger.Message($"Adduser({createModel.Name}"); var result = new Response <NoValue>(); try { var keyAccount = new KeyAccount { Name = createModel.Name, Logo = createModel.Logo, }; _uow.KeyAccounts.Add(keyAccount); _uow.Complete(); result.Status = Status.Success; } catch (Exception ex) { if (ex.InnerException != null && ex.InnerException.InnerException != null && ex.InnerException.InnerException.Message.Contains("duplicate key")) { result.Message = Message.UniqueName; } else { result.Message = Message.SomethingWrongError; } result.Status = Status.Error; Logger.ErrorWithException(ex); } return(result); }
private void BindKeyAccount() { DropDownListKeyAccount.ClearSelection(); DropDownListKeyAccount.DataSource = KeyAccount.GetKeyAccountList(); DropDownListKeyAccount.DataTextField = "Description"; DropDownListKeyAccount.DataValueField = "KeyAccountId"; DropDownListKeyAccount.DataBind(); DropDownListKeyAccount.Items.Insert(0, new ListItem("Please select", "0")); }
private static int Keynum(int num, bool capitalKey, bool smallKey, bool numKey, bool specialCharacter, List <KeyAccount> keyCapital) { int n = 0; if (capitalKey) { var temp = new KeyAccount() { Scale = (double)1, Key = new List <string>() }; keyCapital.Add(temp); for (int i = 'A'; i < 'Z' + 1; i++) { temp.Key.Add(((char)i).ToString()); } n++; } if (smallKey) { var temp = new KeyAccount() { Scale = (double)1, Key = new List <string>() }; keyCapital.Add(temp); for (int i = 'a'; i < 'z' + 1; i++) { temp.Key.Add(((char)i).ToString()); } n++; } if (numKey) { keyCapital.Add(new KeyAccount() { Scale = (double)1 / 2, Key = new List <string>() { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" } }); n++; } if (specialCharacter) { keyCapital.Add(new KeyAccount() { Scale = (double)1 / 2, Key = new List <string>() { "!", "@", "#", "$", "%", "^", "&", "*" } }); n++; } if ((n == 0) || (num < n)) { throw new ArgumentException(); } return(n); }