public List <ExtendedPlay> GetAllTheEpsOf(string email) { AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); EPQueriesCommands epCQ = new EPQueriesCommands(); return(epCQ.GetAllEpsOf(AuthCQ.GetAccountByEmail(email))); }
public bool IsAccountContainsThisSolo(string email, Guid soloId) { SoloQueriesCommands soloCQ = new SoloQueriesCommands(); AuthQueriesCommands authCQ = new AuthQueriesCommands(); var account = authCQ.GetAccountByEmail(email.ToLower()); if (account == null) { return(false); } var solos = soloCQ.GetAllSolosOf(account); if (solos.Count > 0) { if (solos.Any(rec => rec.SingleTrackDetail.Id == soloId)) { return(true); } else { return(false); } } else { return(false); } }
public bool IsBankDetailsExistsOf(string userEmail) { BankQueriesCommands BankCQ = new BankQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); return(BankCQ.IsBankDetailsExistsOf(AuthCQ.GetAccountByEmail(userEmail))); }
public int PurchaseSoloFor(string userEmail) { PurchaseRecordQueriesCommands PrCQ = new PurchaseRecordQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); var account = AuthCQ.GetAccountByEmail(userEmail); if (account != null) { logic = new GeneralLogics(); var purchaseId = logic.CreateUniqueId(); PurchaseRecord pr = new PurchaseRecord(); pr.Id = purchaseId; pr.Purchased_Category = "solo"; pr.Account_Id = account.Id; pr.PurchaseDate = logic.CurrentIndianTime(); var result = PrCQ.AddPurchaseRecord(pr); if (result == 1) { return(1); } else { return(0); } } else { //Account not found return(2); } }
public int CreateNewEp(string email, string epName, int totalTrack) { logic = new GeneralLogics(); PurchaseRecordQueriesCommands purchaseCQ = new PurchaseRecordQueriesCommands(); EPQueriesCommands EpCQ = new EPQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); Account account = AuthCQ.GetAccountByEmail(email); if (account != null) { var GetListOfUnUsedPurchase = purchaseCQ.GetUnUsedEpPurchaseRecordOf(account); if (GetListOfUnUsedPurchase.Count > 0) { ExtendedPlay ep = new ExtendedPlay(); ep.Id = logic.CreateUniqueId(); ep.Ep_Name = epName; ep.Total_Track = totalTrack; ep.Ep_Creation_Date = logic.CurrentIndianTime(); ep.Submitted_Track = 0; ep.PurchaseTrack_RefNo = GetListOfUnUsedPurchase.First().Id; var resultCreateEp = EpCQ.CreateEP(ep); if (resultCreateEp == 1) { var purchaseRecord = purchaseCQ.GetPurchaseRecordById(ep.PurchaseTrack_RefNo); purchaseRecord.Usage_Date = logic.CurrentIndianTime(); int resultPurchaseRecordUpdate = purchaseCQ.UpdatePurchaseRecord(purchaseRecord); if (resultPurchaseRecordUpdate == 1) { //Ep created, PurchaseRecord is modified with UsageDate. Operation Completed successfully return(1); } else { //Internal error occured while updating the record in PurchaseRecord table.Operation failed return(4); } } else { //Ep creation failed return(3); } } else { //No purchase left to create an music Ep. return(2); } } else { //No Account Found return(0); } }
public List <Album> GetAllTheAlbumsOf(string email) { AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); AlbumQueriesCommands AlbumCQ = new AlbumQueriesCommands(); return(AlbumCQ.GetAllAlbumsOf(AuthCQ.GetAccountByEmail(email))); }
public int CreateNewAlbum(string email, string albumName, int totalTrack) { logic = new GeneralLogics(); PurchaseRecordQueriesCommands purchaseCQ = new PurchaseRecordQueriesCommands(); AlbumQueriesCommands AlbumCQ = new AlbumQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); Account account = AuthCQ.GetAccountByEmail(email); if (account != null) { var GetListOfUnUsedPurchase = purchaseCQ.GetUnUsedAlbumPurchaseRecordOf(account); if (GetListOfUnUsedPurchase.Count > 0) { Album album = new Album(); album.Id = logic.CreateUniqueId(); album.Album_Name = albumName; album.Total_Track = totalTrack; album.Album_Creation_Date = logic.CurrentIndianTime(); album.Submitted_Track = 0; album.PurchaseTrack_RefNo = GetListOfUnUsedPurchase.First().Id; var resultCreateAlbum = AlbumCQ.CreateAlbum(album); if (resultCreateAlbum == 1) { var purchaseRecord = purchaseCQ.GetPurchaseRecordById(album.PurchaseTrack_RefNo); purchaseRecord.Usage_Date = logic.CurrentIndianTime(); int resultPurchaseRecordUpdate = purchaseCQ.UpdatePurchaseRecord(purchaseRecord); if (resultPurchaseRecordUpdate == 1) { //Album created, PurchaseRecord is modified with UsageDate. Operation Completed successfully return(1); } else { //Internal error occured while updating the record in PurchaseRecord table.Operation failed return(4); } } else { //Album creation failed return(3); } } else { //No purchase left to create an music album. return(2); } } else { //No Account Found return(0); } }
public bool IsAccountContainsThisAlbum(string email, Guid albumId) { AlbumQueriesCommands AlbumCQ = new AlbumQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); var account = AuthCQ.GetAccountByEmail(email.ToLower()); if (account == null) { return(false); } var albums = AlbumCQ.GetAllAlbumsOf(account); if (albums.Count > 0) { if (albums.Any(rec => rec.Id == albumId)) { return(true); } else { return(false); } } else { return(false); } }
public int DeleteAccount(string email) { AuthQueriesCommands authCQ = new AuthQueriesCommands(); var result = authCQ.GetAccountByEmail(email); if (result != null) { var newResult = authCQ.DeleteAccount(result); if (newResult == 1) { //Account active status has been changed successfully return(1); } else { //Exception has been thrown return(2); } } else { //No account found with the email provided return(0); } }
public List <SoloTrackMaster> GetAllTheSolosOf(string email) { AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); SoloQueriesCommands soloCQ = new SoloQueriesCommands(); return(soloCQ.GetAllSolosOf(AuthCQ.GetAccountByEmail(email))); }
public int ChangePassword(Account accountDetails) { AuthQueriesCommands auth = new AuthQueriesCommands(); //0 for failure 1, for success return(auth.ChangePassword(accountDetails)); }
public bool IsAccountContainsThisEp(string email, Guid epId) { EPQueriesCommands EpCQ = new EPQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); var account = AuthCQ.GetAccountByEmail(email.ToLower()); if (account == null) { return(false); } var Eps = EpCQ.GetAllEpsOf(account); if (Eps != null) { if (Eps.Any(rec => rec.Id == epId)) { return(true); } else { return(false); } } else { return(false); } }
public int EditBankDetails(string userEmail, string payee_first_name, string payee_last_name, string payee_bank_name, string payee_bank_account, string payee_bank_ifsc, string payee_bank_branch) { //Code to change the bank details submitted by user BankQueriesCommands BankCQ = new BankQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); var account = AuthCQ.GetAccountByEmail(userEmail); if (account != null) { if (IsBankDetailsExistsOf(userEmail)) { var bankDetails = BankCQ.GetBankDetailOf(account); if (bankDetails != null) { bankDetails.Account_Id = account.Id; bankDetails.PayeeBankAccountNumber = payee_bank_account; bankDetails.PayeeBankName = payee_bank_name; bankDetails.PayeeBankIfscNumber = payee_bank_ifsc; bankDetails.PayeeBankBranch = payee_bank_branch; bankDetails.PayeeFirstName = payee_first_name; bankDetails.PayeeLastName = payee_last_name; bankDetails.Detail_Submitted_At = logic.CurrentIndianTime(); var result = BankCQ.EditBankDetails(bankDetails); if (result == 1) { //Changes done successfully return(1); } else { //Internal error occured while changing bank detais return(4); } } else { //No bank details is associated with the account return(3); } } else { //No bank details found for this account return(2); } } else { //No account found with this email id return(0); } }
//Login process public Account Login(string email, string password) { AuthQueriesCommands auth = new AuthQueriesCommands(); var result = auth.LogInAccount(email.ToLower().Trim(), password); if (result != null) { return(result); } else { return(null); } }
public Guid?GetFirstPurchaseIdForSoloOf(string email) { AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); var accountObject = AuthCQ.GetAccountByEmail(email); if (accountObject != null) { PurchaseRecordQueriesCommands prCQ = new PurchaseRecordQueriesCommands(); return(prCQ.GetUnUsedSoloPurchaseRecordOf(accountObject).First().Id); } else { return(null); } }
public bool IsAccountContainsThisPurchase(string email, Guid?purchaseId) { AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); var accountObject = AuthCQ.GetAccountByEmail(email); if (accountObject != null) { PurchaseRecordQueriesCommands prCQ = new PurchaseRecordQueriesCommands(); return(prCQ.GetAllPurchaseRecordsOf(accountObject).Any(rec => rec.Id == purchaseId)); } else { //No account found with this email return(false); } }
public BankDetail GetBankDetailOf(string userEmail) { BankQueriesCommands BankCQ = new BankQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); var accountObject = AuthCQ.GetAccountByEmail(userEmail); if (accountObject != null) { //Account found now returning the bank details return(BankCQ.GetBankDetailOf(accountObject)); } else { //No Account found with this email return(null); } }
public int CountOfSolosCanBeCreatedBy(string userEmail) { PurchaseRecordQueriesCommands purchaseCQ = new PurchaseRecordQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); Account account = AuthCQ.GetAccountByEmail(userEmail); if (account != null) { var GetListOfUnUsedPurchase = purchaseCQ.GetUnUsedSoloPurchaseRecordOf(account); //Returning the count of the unused purchase of Eps for the user return(GetListOfUnUsedPurchase.Count); } else { //No Account Found return(0); } }
public int CountOfAlbumsAlreadyCreatedBy(string email) { PurchaseRecordQueriesCommands purchaseCQ = new PurchaseRecordQueriesCommands(); AuthQueriesCommands AuthCQ = new AuthQueriesCommands(); Account account = AuthCQ.GetAccountByEmail(email); if (account != null) { var GetListOfUnUsedPurchase = purchaseCQ.GetUsedAlbumPurchaseRecordOf(account); //Returning the count of the unused purchase of albums for the user return(GetListOfUnUsedPurchase.Count); } else { //No Account Found return(0); } }
public List <Account> GetAllAccounts() { AuthQueriesCommands authCQ = new AuthQueriesCommands(); return(authCQ.GetAllAccounts()); }
//Sign Up process public int SignUp(string firstName, string lastName, string email, string mobile, string address, string password) { Account acc = new Account(); UserDetail ud = new UserDetail(); AuthQueriesCommands auth = new AuthQueriesCommands(); if (auth.IsAccountExist(email)) { //Duplicate record found return(0); } else { logic = new GeneralLogics(); Guid NewAccountId = logic.CreateUniqueId(); acc.Id = NewAccountId; acc.Email = email.ToLower().Trim(); acc.Account_Role = auth.GetNormalUserRoleId(); acc.Password = password; acc.Account_Status = 1; acc.Account_Creation_Date = logic.CurrentIndianTime(); ud.User_Account_Id = NewAccountId; ud.User_Address = address; ud.User_Mobile_Number = mobile; ud.User_First_Name = firstName; ud.User_Last_Name = lastName; var result = auth.Register(acc); if (result == 0) { //Account creation failed return(2); } else { //Account successfully created result = auth.Register(ud); if (result == 1) { //User details and account creation successfull return(1); } else { //Remove recently created account as there is a problem while creating the user details for the same. result = auth.RemoveAccountPermanantly(acc); if (result == 1) { //Account deleted parmanantly return(4); } else { //Account removal failed and user details could not be created return(3); } } } } }
public bool IsUserAdmin(string email) { AuthQueriesCommands authCQ = new AuthQueriesCommands(); return(authCQ.IsSuperAdmin(email)); }
public Account FindAccountByEmail(string email) { AuthQueriesCommands auth = new AuthQueriesCommands(); return(auth.GetAccountByEmail(email)); }