public ActionResult EditRole(int roleId, string roleName) { logics = new GeneralLogics(); if (logics.ContainsOnlyAlphabets(roleName)) { businessLogics = new BusinessLogics(); var result = businessLogics.EditRole(roleId, roleName); if (result == 1) { return(RedirectToAction("Index", "SiteRoleManagement")); } else if (result == 0) { ViewBag.ErrorMsg = "No role found with the associated Id."; } else if (result == 3) { ViewBag.ErrorMsg = "Role already exists"; } else { ViewBag.ErrorMsg = "Internal Error occured while modifying role."; } } else { ViewBag.ErrorMsg = "Invalid Role name entered"; } return(RedirectToAction("Index", "SiteRoleManagement")); }
public ActionResult AddRole(string roleName) { logics = new GeneralLogics(); if (logics.ContainsOnlyAlphabets(roleName)) { businessLogics = new BusinessLogics(); var result = businessLogics.Addrole(roleName); if (result == 1) { return(RedirectToAction("Index", "SiteRoleManagement")); } else if (result == 0) { ViewBag.ErrorMsg = "Role already exists."; } else { ViewBag.ErrorMsg = "Internal Error occured while adding new role"; } } else { ViewBag.ErrorMsg = "Invalid Role name entered"; } return(View("AddorEditRole")); }
public ActionResult AddBankDetails(string payee_first_name, string payee_last_name, string payee_bank_name, string payee_bank_account, string payee_bank_ifsc, string payee_bank_branch) { logics = new GeneralLogics(); businessLogics = new BusinessLogics(); string email = Session["LoginEmail"].ToString(); //string email = "*****@*****.**"; var result = businessLogics.FindAccountByEmail(email); if (result != null) { List <string> inputDetails = new List <string> { payee_first_name, payee_last_name, payee_bank_name, email, payee_bank_account, payee_bank_ifsc, payee_bank_branch }; if (logics.ContainsAnyNullorWhiteSpace(inputDetails)) { ViewBag.ErrorMsg = "No Field Should be left blank"; } if (!logics.ContainsOnlyDigits(payee_bank_account)) { ViewBag.ErrorMsg = "Invalid bank account number"; } if (payee_bank_ifsc.Length != 11 && !logics.ContainsOnlyAlphabets(payee_bank_ifsc.Substring(0, 4))) { ViewBag.ErrorMsg = "Invalid bank IFSC number"; } if (!logics.ContainsOnlyAlphabets(payee_first_name) && !logics.ContainsOnlyAlphabets(payee_last_name)) { ViewBag.ErrorMsg = "Invalid Payee name invalid"; } var bankaccountCreationResult = businessLogics.AddBankDetails(result.Id, payee_first_name, payee_last_name, payee_bank_name, payee_bank_account, payee_bank_ifsc, payee_bank_branch); if (bankaccountCreationResult == 1) { //Bank details created successfully return(RedirectToAction("Index", "UserProfile")); } //else if (bankaccountCreationResult == 2) //{ // ViewBag.ErrorMsg = "Internal server error occured while inserting data to the database"; //} else { ViewBag.ErrorMsg = "Internal server error occured while inserting data to the database"; } } else { ViewBag.ErrorMsg = "Account information retreval failed"; } return(View()); }
public ActionResult CreateOnlyAlbum(string albumName, string totalTrack) { logics = new GeneralLogics(); businessLogics = new BusinessLogics(); List <string> inputStrings = new List <string> { albumName, totalTrack }; string userEmail = Session["LoginEmail"].ToString(); //string userEmail = "*****@*****.**"; if (userEmail != null) { if (!logics.ContainsAnyNullorWhiteSpace(inputStrings)) { if (logics.ContainsOnlyDigits(totalTrack)) { var result = businessLogics.CreateNewAlbum(userEmail, albumName, Convert.ToInt32(totalTrack)); if (result == 0) { ViewBag.ErrorMsg = "No Account is associated with the email address from which user is trying to create the album."; } if (result == 1) { return(RedirectToAction("Index", "UserProfile")); } if (result == 2) { ViewBag.ErrorMsg = "No purchase left to create an music album"; } if (result == 3 || result == 4) { ViewBag.ErrorMsg = "Internal error occured while creating the album"; } } else { ViewBag.ErrorMsg = "Track number field must contains only number. Invalid input given"; } } else { ViewBag.ErrorMsg = "No fields should be left empty"; } } else { return(RedirectToAction("Logout", "Authentication")); } return(View("AddorEditAlbum")); }
public ActionResult EditOnlyAlbum(string albumId, string albumName, string totalTrack) { logics = new GeneralLogics(); businessLogics = new BusinessLogics(); List <string> inputStrings = new List <string> { albumName, totalTrack }; string userEmail = Session["LoginEmail"].ToString(); //string userEmail = "*****@*****.**"; if (userEmail != null) { if (!logics.ContainsAnyNullorWhiteSpace(inputStrings)) { if (logics.ContainsOnlyDigits(totalTrack)) { var result = businessLogics.EditAlbum(Guid.Parse(albumId), albumName, Convert.ToInt32(totalTrack)); if (result == 0) { ViewBag.ErrorMsg = "No album found with the Id provided"; } if (result == 1) { return(RedirectToAction("Index", "UserProfile")); } if (result == 2) { ViewBag.ErrorMsg = "Can't edit album as one song alredy registered under the album"; } if (result == 3) { ViewBag.ErrorMsg = "Internal error occured while creating the album"; } } else { ViewBag.ErrorMsg = "Track number field must contains only number. Invalid input given"; } } else { ViewBag.ErrorMsg = "No fields should be left empty"; } } else { return(RedirectToAction("Logout", "Authentication")); } return(View("AddorEditAlbum")); }
public ActionResult EditTrackDetailsForAlbum(Guid albumId, Guid trackId) { businessLogics = new BusinessLogics(); logic = new GeneralLogics(); string userEmail = Session["LoginEmail"].ToString(); if (userEmail != null && businessLogics.IsAccountContainsThisAlbum(userEmail, albumId)) { var albumDetails = businessLogics.GetAlbumDetail(albumId, trackId); if (albumDetails != null) { if (albumDetails.StoreSubmissionStatus == 0) { var albumPurchase = businessLogics.GetAlbumById((Guid)albumDetails.Album_Id); if (albumPurchase.PurchaseRecord.Usage_Exp_Date > logic.CurrentIndianTime()) { var trackDetail = businessLogics.GetTrackById(trackId); if (trackDetail != null) { ViewBag.Title = "Edit Track"; ViewBag.TrackDetail = trackDetail; ViewBag.TrackId = trackDetail.Id; return(View("EditTrack")); } else { TempData["ErrorMsg"] = "Error while fetching track details"; } } else { TempData["ErrorMsg"] = "Your purchase has expired. you can't modify the track"; } } else { TempData["ErrorMsg"] = "The track is already submitted to store. You can't edit this track"; } } else { TempData["ErrorMsg"] = "Track is not valid"; } } else { TempData["ErrorMsg"] = "You are trying to modify a track details that doesn't belongs to you"; } return(RedirectToAction("ShowIndividualAlbumSongs", "Album", new { albumId = albumId })); }
public ActionResult Login(string email, string password) { logics = new GeneralLogics(); businessLogics = new BusinessLogics(); if (logics.ValidEmail(email) && !String.IsNullOrWhiteSpace(email) && !String.IsNullOrWhiteSpace(password) && password.Length < 6) { ViewBag.ErrorMsg = "Invalid Email input"; } else { var result = businessLogics.Login(email, password); if (result != null) { FormsAuthentication.SetAuthCookie(result.Email.ToString(), false); //FormsAuthenticationTicket Authticket = new FormsAuthenticationTicket( // 1, // result.Email.ToString() + ",", // DateTime.Now, // DateTime.Now.AddMinutes(120), // false, // null); //string hash = FormsAuthentication.Encrypt(Authticket); //HttpCookie Authcookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash); //if (Authticket.IsPersistent) // Authcookie.Expires = Authticket.Expiration; //Response.Cookies.Add(Authcookie); Session["LoginEmail"] = result.Email; Session["UserName"] = result.UserDetail.User_First_Name.ToString(); return(RedirectToAction("Index", "UserProfile")); } else { ViewBag.ErrorMsg = "No account found with the credential provided"; } } return(View()); }
public ActionResult PasswordReset(string email, string oldPassword, string newPassword) { logics = new GeneralLogics(); businessLogics = new BusinessLogics(); var result = businessLogics.FindAccountByEmail(email); if (result != null) { if (result.Password == oldPassword) { if (oldPassword == newPassword) { ViewBag.ErrorMsg = "Old Password can't be your new password"; } else { result.Password = newPassword; var newResult = businessLogics.ChangePassword(result); if (newResult == 1) { return(RedirectToAction("Logout", "Authentication")); } else if (newResult == 0) { ViewBag.ErrorMsg = "Internal Error occured. Failed to change tha password"; } else { ViewBag.ErrorMsg = "Error occured while changing Password"; } } } else { ViewBag.ErrorMsg = "Please enter your valid old Password"; } } return(View()); }
public ActionResult EditTrackDetails(Guid trackId, string TrackTitle, string ArtistName, string ArtistAlreadyInSpotify, string ArtistSpotifyUrl, DateTime ReleaseDate, string Genre, string CopyrightClaimerName, string AuthorName, string ComposerName, string ArrangerName, string ProducerName, string AlreadyHaveAnISRC, string ISRC_Number, string PriceTier, string ExplicitContent, string IsTrackInstrumental, string LyricsLanguage, string TrackZipFileLink, string ArtWork_Link) { ViewBag.TrackId = trackId; List <string> mandetoryFieldsInput = new List <string> { TrackTitle, ArtistName, Genre, CopyrightClaimerName, AuthorName, ComposerName, ArrangerName, ProducerName, PriceTier, TrackZipFileLink, ArtWork_Link }; List <string> mandetoryBoolFields = new List <string> { ArtistAlreadyInSpotify, AlreadyHaveAnISRC, ExplicitContent, IsTrackInstrumental }; logic = new GeneralLogics(); if (!logic.ContainsAnyNullorWhiteSpace(mandetoryFieldsInput)) { if (!logic.ContainsAnyNullorWhiteSpace(mandetoryBoolFields)) { bool isArtistOnSpotify = false, isTrackHasISRC = false, isTrackHasExplicitContent = false, isTrackInstrumental = false; if (ArtistAlreadyInSpotify == "yes") { isArtistOnSpotify = true; } if (AlreadyHaveAnISRC == "yes") { isTrackHasISRC = true; } if (ExplicitContent == "yes") { isTrackHasExplicitContent = true; } if (IsTrackInstrumental == "yes") { isTrackInstrumental = true; } if ((isArtistOnSpotify && !String.IsNullOrWhiteSpace(ArtistSpotifyUrl.Trim())) || (isArtistOnSpotify == false && String.IsNullOrWhiteSpace(ArtistSpotifyUrl.Trim()))) { if ((isTrackHasISRC && !String.IsNullOrWhiteSpace(ISRC_Number.Trim())) || (isTrackHasISRC == false && String.IsNullOrWhiteSpace(ISRC_Number.Trim()))) { if ((isTrackInstrumental && String.IsNullOrWhiteSpace(LyricsLanguage.Trim())) || (isTrackInstrumental == false && !String.IsNullOrWhiteSpace(LyricsLanguage.Trim()))) { if (ReleaseDate != null && ReleaseDate > logic.CurrentIndianTime()) { //Code to add the song to the album businessLogics = new BusinessLogics(); var result = businessLogics.EditTrack(trackId, TrackTitle, ArtistName, isArtistOnSpotify, ArtistSpotifyUrl, ReleaseDate, Genre, CopyrightClaimerName, AuthorName, ComposerName, ArrangerName, ProducerName, isTrackHasISRC, ISRC_Number, Convert.ToInt32(PriceTier), isTrackHasExplicitContent, isTrackInstrumental, LyricsLanguage, TrackZipFileLink, ArtWork_Link); if (result == 1) { return(RedirectToAction("Index", "UserProfile")); } else if (result == 7) { ViewBag.ErrorMsg = "Your purchase has expired. you can't add the track to the album."; } else if (result == 8) { ViewBag.ErrorMsg = "You can't add the track as the album is full."; } else { ViewBag.ErrorMsg = "Internal Error occured"; } } else { ViewBag.ErrorMsg = "Provide a valid Date to release your track"; } } else { ViewBag.ErrorMsg = "If it's an instrumental track then leave the Lyrics Language field empty"; } } else { ViewBag.ErrorMsg = "If you have ISRC number for the track then select yes and provide the number. Otherwise select no and leave the field empty."; } } else { ViewBag.ErrorMsg = "If artist is already on spotify then select yes and provide the link of the artist. Otherwise select no and leave the field empty."; } } else { ViewBag.ErrorMsg = "Select proper options from dropdowns"; } } else { ViewBag.ErrorMsg = "Mandetory Fields can't be left empty"; } return(View("EditTrack")); }
public ActionResult SignUp(string first_name, string last_name, string mobile, string email, string address1, string address2, string pincode, string password, string con_password) { logics = new GeneralLogics(); businessLogics = new BusinessLogics(); List <string> inputValues = new List <string> { first_name, last_name, mobile, email, address1, address2, pincode, password, con_password }; if (logics.ContainsAnyNullorWhiteSpace(inputValues)) { ViewBag.ErrorMsg = "No Field Should be left blank"; } else { if (!logics.ContainsOnlyDigits(mobile) && mobile.Length != 10 && pincode.Length != 6 && !logics.ContainsOnlyDigits(pincode)) { ViewBag.ErrorMsg = "Mobile or Pincode invalid "; } else if (!logics.ValidEmail(email)) { ViewBag.ErrorMsg = "Invalid Email provided"; } else { if (!logics.ContainsOnlyAlphabets(first_name) && !logics.ContainsOnlyAlphabets(last_name)) { ViewBag.ErrorMsg = "First name and Last name is invalid"; } else { if (password.Length < 6) { ViewBag.ErrorMsg = "Password length must be of minimum 6"; } else { if (password != con_password) { ViewBag.ErrorMsg = "Password and Confirm paswword field must contain same value"; } else { //Formatting Address string Address = "AddressLine1: " + address1 + ", AddressLine2: " + address2 + ", Pin: " + pincode; var account = businessLogics.SignUp(first_name, last_name, email, mobile, Address, password); /* 0 = duplicate record found * 1 = Operation done successfully * 2 = Account creation failed * 3 = Account removal failed and user details could not be created * 4 = Account deleted parmanantly */ if (account == 1) { return(RedirectToAction("Login", "Authentication")); } else if (account == 2 || account == 3 || account == 4) { ViewBag.ErrorMsg = "Internal server error occured. Couldn't create your account"; } else if (account == 0) { ViewBag.ErrorMsg = "An account already exists with same email."; } } } } } } return(View()); }
public ActionResult EditOnlyEp(Guid epId, string epName, string totalTrack) { ViewBag.Title = "Edit Ep"; logics = new GeneralLogics(); businessLogics = new BusinessLogics(); List <string> inputStrings = new List <string> { epName, totalTrack }; //string userEmail = Session["LoginEmail"].ToString(); string userEmail = "*****@*****.**"; if (userEmail != null) { if (!logics.ContainsAnyNullorWhiteSpace(inputStrings)) { if (logics.ContainsOnlyDigits(totalTrack)) { if (Convert.ToInt32(totalTrack) > 7) { TempData["ErrorMsg"] = "An Ep can be created with 7 or less amount of tracks"; //ViewBag.ErrorMsg = "An Ep can be created with 7 or less amount of tracks"; } else { var result = businessLogics.EditEp(epId, epName, Convert.ToInt32(totalTrack)); if (result == 0) { ViewBag.ErrorMsg = "No Account is associated with the email address from which user is trying to modify the Ep."; } if (result == 1) { return(RedirectToAction("Index", "UserProfile")); } if (result == 2) { ViewBag.ErrorMsg = "No purchase left to create an music Ep"; } if (result == 3 || result == 4) { ViewBag.ErrorMsg = "Internal error occured while creating the Ep"; } } } else { TempData["ErrorMsg"] = "Track number field must contains only number. Invalid input given"; //ViewBag.ErrorMsg = "Track number field must contains only number. Invalid input given"; } } else { TempData["ErrorMsg"] = "No fields should be left empty"; //ViewBag.ErrorMsg = "No fields should be left empty"; } } else { return(RedirectToAction("Logout", "Authentication")); } return(RedirectToAction("EditOnlyEp", new { epID = epId })); }