public bool LoginPartnerAccount(PartnerAccount partner) { try { string pass = partner.password.ToString(); var acountSalt = (from c in data.PartnerAccounts where c.partnerAccount1 == partner.partnerAccount1 select c.salt).FirstOrDefault().ToString(); if (acountSalt == null) { return(false); } var str = pass + acountSalt; var MD5Pass = Encryptor.MD5Hash(str); var acount = data.PartnerAccounts.Where(x => x.partnerAccount1 == partner.partnerAccount1 && x.password == MD5Pass).FirstOrDefault(); if (acount == null) { return(false); } else { return(true); } } catch { return(false); } }
public bool AddPartnerAccount(PartnerAccount account) { try { if (data.PartnerAccounts.Any(x => x.accountNumber == account.accountNumber)) { return(false); } var accountID = account.accountNumber; Account accountModify = (from c in data.Accounts where c.accountNumber == accountID && c.status == 1 select c).Single(); if (accountModify == null) { return(false); } string salt = Guid.NewGuid().ToString().Substring(0, 7); account.salt = salt; string pin = "123456"; var str = pin + salt; var MD5Pass = Encryptor.MD5Hash(str); account.password = MD5Pass; account.status = 1; data.PartnerAccounts.InsertOnSubmit(account); data.SubmitChanges(); return(true); } catch { return(false); } }
partial void DeletePartnerAccount(PartnerAccount instance);
partial void UpdatePartnerAccount(PartnerAccount instance);
partial void InsertPartnerAccount(PartnerAccount instance);