示例#1
0
 public ActionResult ShowAlbumTrackDetail(Guid albumId, Guid trackId, int?StoreSubmissionStatus)
 {
     if (Session["LoginEmail"] != null)
     {
         string userEmail = Session["LoginEmail"].ToString();
         businessLogics = new BusinessLogics();
         var singlesOfThisAlbum = businessLogics.GetTrackDetailsOfAlbum(albumId);
         if ((businessLogics.IsAccountContainsThisAlbum(userEmail, albumId) &&
              singlesOfThisAlbum.Any(solo => solo.Id == trackId)) ||
             User.IsInRole("superadmin") ||
             User.IsInRole("admin"))
         {
             ViewBag.TrackDetail           = singlesOfThisAlbum.Where(track => track.Id == trackId).SingleOrDefault();
             ViewBag.Category              = "Album";
             ViewBag.AlbumDetail           = businessLogics.GetAlbumById(albumId);
             ViewBag.StoreSubmissionStatus = StoreSubmissionStatus;
             return(View("ShowTrackDetail"));
         }
         else
         {
             TempData["ErrorMsg"] = "Something suspecious occured";
             return(RedirectToAction("Index", "UserProfile"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "UserProfile"));
     }
 }
示例#2
0
        public ActionResult Index()
        {
            if (Session["LoginEmail"] == null)
            {
                return(RedirectToAction("Logout", "Authentication"));
            }
            businessLogics = new BusinessLogics();

            var pendingAlbumsGroup = businessLogics.GetAllAlbumsWithTracks()
                                     .Where(obj => obj.SingleTrackDetail.ReleaseDate <= DateTime.Now.AddHours(23) && obj.StoreSubmissionStatus == 2)
                                     .ToList();


            var pendingEps = businessLogics.GetAllEpsWithTracks()
                             .Where(obj => obj.SingleTrackDetail.ReleaseDate <= DateTime.Now.AddHours(23) && obj.StoreSubmissionStatus == 2)
                             .ToList();

            var pendingSolos = businessLogics.GetAllSolosWithTracks()
                               .Where(obj => obj.SingleTrackDetail.ReleaseDate <= DateTime.Now.AddHours(23) && obj.StoreSubmissionStatus == 2)
                               .ToList();

            ViewBag.PendingAlbumsWithTrackDetail = pendingAlbumsGroup;
            ViewBag.PendingEpsWithTrackDetail    = pendingEps;
            ViewBag.PendingSolosWithTrackDetail  = pendingSolos;

            return(View());
        }
示例#3
0
        public ActionResult EditOnlyEp(Guid epId)
        {
            //string userEmail = Session["LoginEmail"].ToString();
            string userEmail = "*****@*****.**";

            businessLogics = new BusinessLogics();

            if (userEmail != null)
            {
                if (businessLogics.IsAccountContainsThisEp(userEmail, epId))
                {
                    ViewBag.Title = "Edit Album";

                    var epObject = businessLogics.GetEpById(epId);
                    if (epObject != null)
                    {
                        ViewBag.EpDetail = epObject;
                    }
                    else
                    {
                        ViewBag.ErrorMsg = "No Ep found with the Id provided";
                    }
                    return(View("AddorEditEp"));
                }
                else
                {
                    TempData["ErrorMsg"] = "You are trying to modify an Ep that does not belongs to you";
                    return(RedirectToAction("Index", "UserProfile"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "UserProfile"));
            }
        }
示例#4
0
 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"));
 }
示例#5
0
        public ActionResult DeActivateAccount()
        {
            businessLogics = new BusinessLogics();

            if (Session["LoginEmail"] == null)
            {
                return(RedirectToAction("Logout", "Authentication"));
            }

            string email  = Session["LoginEmail"].ToString();
            var    result = businessLogics.DeleteAccount(email);

            if (result == 0)
            {
                ViewBag.ErrorMsg = "No account found with the email provided";
            }
            else if (result == 1)
            {
                //Successfully deactivated the account
                return(RedirectToAction("Logout", "Authentication"));
            }
            else
            {
                ViewBag.ErrorMsg = "Internal Error occured while deleting your account";
            }
            return(RedirectToAction("Index", "UserProfile"));
        }
示例#6
0
        public ActionResult EditRole(int?id)
        {
            businessLogics = new BusinessLogics();
            if (id != null)
            {
                ViewBag.Title = "Edit Role";
                var result = businessLogics.GetRole((Int32)id);

                if (result != null)
                {
                    ViewBag.RoleId   = result.Id;
                    ViewBag.RoleName = result.Role_Name;
                }
                else
                {
                    ViewBag.ErrorMsg = "No role found with the Id provided";
                }
            }
            else
            {
                ViewBag.Title = "Url Error";
            }


            return(View("AddorEditRole"));
        }
示例#7
0
        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 SearchStats(SearchRequest sr)
        {
            StatisDatas cd = new StatisDatas();

            BusinessLogics.GetLists(sr.From, sr.To);
            cd.avgFlow     = BusinessLogics.avgFlow;
            cd.avgPressure = BusinessLogics.maxPressure;
            cd.avgTemp     = BusinessLogics.avgTemp;
            cd.maxFlow     = BusinessLogics.maxFlow;
            cd.maxPressure = BusinessLogics.maxPressure;
            cd.maxTemp     = BusinessLogics.maxTemp;
            cd.minPressure = BusinessLogics.minPressure;
            cd.minTemp     = BusinessLogics.minTemp;
            cd.minFlow     = BusinessLogics.minFlow;
            cd.minute      = BusinessLogics.minute;

            //cd.avgFlow = new List<float>();
            //cd.avgPressure = new List<float>();
            //cd.avgTemp = new List<float>();
            //cd.maxFlow = new List<float>();
            //cd.maxPressure = new List<float>();
            //cd.maxTemp = new List<int>();
            //cd.minPressure = new List<float>();
            //cd.minTemp = new List<int>();
            //cd.minFlow = new List<float>();
            //cd.minute = new List<string>();
            return(Json(cd, JsonRequestBehavior.AllowGet));
        }
示例#9
0
        public ActionResult ShowSoloTrackDetail(Guid trackId, int?StoreSubmissionStatus)
        {
            string userEmail = Session["LoginEmail"].ToString();

            if (userEmail != null)
            {
                businessLogics = new BusinessLogics();
                if (businessLogics.IsAccountContainsThisSolo(userEmail, trackId) || User.IsInRole("superadmin") || User.IsInRole("admin"))
                {
                    ViewBag.Title = "Solo Details";

                    var soloObject = businessLogics.GetTrackById(trackId);
                    if (soloObject != null)
                    {
                        ViewBag.TrackDetail           = soloObject;
                        ViewBag.StoreSubmissionStatus = StoreSubmissionStatus;
                    }
                    else
                    {
                        ViewBag.ErrorMsg = "No track found with the Id provided";
                    }
                    return(View("ShowTrackDetail"));
                }
                else
                {
                    TempData["ErrorMsg"] = "You are trying to view a track detail that does not belongs to you";
                    return(RedirectToAction("Index", "UserProfile"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "UserProfile"));
            }
        }
示例#10
0
        public ActionResult AddTrackToSolo()
        {
            businessLogics = new BusinessLogics();
            string userEmail = Session["LoginEmail"].ToString();
            //Get first unused purchaseId for the user to create solo
            Guid?purchaseId = businessLogics.GetFirstPurchaseIdForSoloOf(userEmail);

            if (purchaseId != null)
            {
                if (userEmail != null && businessLogics.IsAccountContainsThisPurchase(userEmail, purchaseId))
                {
                    if (!businessLogics.IsPurchaseExpired(purchaseId))
                    {
                        ViewBag.PurchaseId = purchaseId;
                        ViewBag.Title      = "Add Track";
                        return(View("AddTrackSolo"));
                    }
                    else
                    {
                        TempData["ErrorMsg"] = "Your purchase has expired";
                    }
                }
                else
                {
                    TempData["ErrorMsg"] = "You are trying to add an track to an Ep that doesn't belongs to you.";
                }
            }
            else
            {
                TempData["ErrorMsg"] = "You don't have any purchase record left to submit a solo track.";
            }
            return(RedirectToAction("Index", "UserProfile"));
        }
示例#11
0
        public ActionResult Index()
        {
            if (Session["LoginEmail"] == null)
            {
                return(RedirectToAction("Logout", "Authentication"));
            }

            businessLogics = new BusinessLogics();

            string userEmail = Session["LoginEmail"].ToString();

            //string userEmail = "*****@*****.**";

            // to help view to find out if it will allow user to add bank details
            if (businessLogics.IsBankDetailsExistsOf(userEmail))
            {
                ViewBag.BankAccountSubmissionStatus = 1;
            }
            else
            {
                ViewBag.BankAccountSubmissionStatus = 0;
            }

            //to help view to find out how many Albums can be created by user
            int AlbumsAlreadyCreated   = businessLogics.CountOfAlbumsAlreadyCreatedBy(userEmail);
            int AlbumCountLeftToCreate = businessLogics.CountOfAlbumsCanBeCreatedBy(userEmail);

            ViewBag.AlbumCount = AlbumCountLeftToCreate;
            //pass the album details
            if (AlbumsAlreadyCreated > 0)
            {
                ViewBag.Albums = businessLogics.GetAllTheAlbumsOf(userEmail);
            }

            //Code space for ep

            //to help view to find out how many Eps can be created by user
            int EpsAlreadyCreated   = businessLogics.CountOfEpsAlreadyCreatedBy(userEmail);
            int EpCountLeftToCreate = businessLogics.CountOfEpsCanBeCreatedBy(userEmail);

            ViewBag.EpCount = EpCountLeftToCreate;
            //pass the Ep details
            if (EpsAlreadyCreated > 0)
            {
                ViewBag.Eps = businessLogics.GetAllTheEpsOf(userEmail);
            }

            //Code space for Solo
            int SolosAlreadyCreated   = businessLogics.CountOfSolosAlreadyCreatedBy(userEmail);
            int SoloCountLeftToCreate = businessLogics.CountOfSolosCanBeCreatedBy(userEmail);

            ViewBag.SoloCount = SoloCountLeftToCreate;
            if (SolosAlreadyCreated > 0)
            {
                ViewBag.Solos = businessLogics.GetAllTheSolosOf(userEmail);
            }
            return(View());
        }
        public ActionResult SearchChart(SearchRequest sr)
        {
            ChartAxis ca = new ChartAxis();

            ca.flow  = BusinessLogics.SearchFlow(sr.From, sr.To);
            ca.press = BusinessLogics.SearchPressure(sr.From, sr.To);
            ca.time  = BusinessLogics.SearchTime(sr.From, sr.To);
            ca.temp  = BusinessLogics.SearchTemp(sr.From, sr.To);
            return(Json(ca, JsonRequestBehavior.AllowGet));
        }
示例#13
0
        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 IHttpActionResult Get()
        {
            List <User>   result = BusinessLogics.getAllUsers().ToList();
            IList <Users> users  = Mapper.Map <List <User>, List <Users> >(result);

            if (users.Count == 0)
            {
                return(NotFound());
            }
            return(Ok(users));
        }
        public JsonResult GetTeacherCourses(int teacherId, int deptId)
        {
            var courses     = new BusinessLogics().DepartmentActiveCourses(deptId);
            var CreditTaken = courses.AsEnumerable().Where(x => x.TeacherId == teacherId).Sum(y => y.CourseCredit);

            return(Json(new {
                Courses = courses,
                CreditTaken = CreditTaken
            }
                        , JsonRequestBehavior.AllowGet));
        }
        public JsonResult IsTimeConflicts(int RoomAllocationDayId, int RoomAllocationRoomId, string FromTime, string ToTime)
        {
            if (Convert.ToInt32(FromTime.Replace(":", "")) >= Convert.ToInt32(ToTime.Replace(":", "")))
            {
                return(Json("Start time should not greater than/equal to end time.", JsonRequestBehavior.AllowGet));
            }

            var data = new BusinessLogics().IsTimeConflict(RoomAllocationDayId, RoomAllocationRoomId, FromTime, ToTime);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public IHttpActionResult Get(int id)
        {
            Users subject = Mapper.Map <User, Users>(BusinessLogics.findUser(id));

            if (subject == null)
            {
                return(NotFound());
            }

            return(Ok(subject));
        }
示例#18
0
        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"));
        }
示例#19
0
        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"));
        }
示例#20
0
        public ActionResult PurchaseSolo()
        {
            businessLogics = new BusinessLogics();
            string userEmail = Session["LoginEmail"].ToString();
            var    result    = businessLogics.PurchaseSoloFor(userEmail);

            if (result != 1)
            {
                ViewBag.ErrorMsg = "Purchase was not successfull";
            }
            return(RedirectToAction("Index", "UserProfile"));
        }
示例#21
0
 public ActionResult PermanantlyDeleteAccount(Guid accountId)
 {
     businessLogics = new BusinessLogics();
     if (true)
     {
     }
     else
     {
         TempData["ErrorMsg"] = "Some error occured while changing the role of the account.";
     }
     return(RedirectToAction("ManageUsers", "SuperAdmin"));
 }
        public IHttpActionResult Delete(int id)
        {
            bool success = BusinessLogics.deleteUser(id);

            if (success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest("Invalid data"));
            }
        }
示例#23
0
        public ActionResult PurchaseEp()
        {
            businessLogics = new BusinessLogics();
            string userEmail = Session["LoginEmail"].ToString();
            //string userEmail = "*****@*****.**";
            var result = businessLogics.PurchaseEpFor(userEmail);

            if (result != 1)
            {
                ViewBag.ErrorMsg = "Purchase was not successfull";
            }
            return(RedirectToAction("Index", "UserProfile"));
        }
        public IHttpActionResult Put([FromBody] User user)
        {
            bool success = BusinessLogics.updateUser(user);

            if (success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest("Invalid data"));
            }
        }
        public ActionResult Search(SearchRequest sr)
        {
            List <Signal> l = new List <Signal>();

            for (int i = BusinessLogics.SearchCount() - 1; i > 0; i--)
            {
                if ((DateTime.Compare(BusinessLogics.SearchIndex(i).GetDateInstance(), sr.From) >= 0) && (DateTime.Compare(BusinessLogics.SearchIndex(i).GetDateInstance(), sr.To) <= 0))
                {
                    l.Add(BusinessLogics.SearchIndex(i));
                }
            }
            return(Json(l, JsonRequestBehavior.AllowGet));
        }
        public IHttpActionResult Post([FromBody] Users subject)
        {
            User s       = Mapper.Map <Users, User>(subject);
            bool success = BusinessLogics.addUser(s);

            if (success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest("Invalid data"));
            }
        }
示例#27
0
        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 }));
        }
示例#28
0
        public ActionResult ShowIndividualEpSongs(Guid epId)
        {
            businessLogics = new BusinessLogics();

            var ep = businessLogics.GetEpById(epId);

            ViewBag.Ep = ep;

            //get the list of all tracks of the same Ep
            ViewBag.details = businessLogics.GetAllTracksWithEpDetails(epId);

            ViewBag.IsEpFull = businessLogics.IsEpFull(epId);

            return(View("DisplayEp"));
        }
        public ActionResult RequestData()
        {
            List <Signal> latest = new List <Signal>();

            for (int i = DataCentre._Pool.Count() - 1; i > 0; i--)
            {
                Signal sig = BusinessLogics.SearchIndex(i);
                latest.Add(sig);
                if (i == (BusinessLogics.SearchCount() - 30))
                {
                    i = 0;
                }
            }
            return(Json(latest, JsonRequestBehavior.AllowGet));
        }
示例#30
0
        public ActionResult ShowIndividualAlbumSongs(Guid albumId)
        {
            businessLogics = new BusinessLogics();

            var album = businessLogics.GetAlbumById(albumId);

            ViewBag.Album = album;

            //get the list of all tracks of the same album
            ViewBag.details = businessLogics.GetAllTracksWithAlbumDetails(albumId);

            ViewBag.IsAlbumFull = businessLogics.IsAlbumFull(albumId);

            return(View("DisplayAlbum"));
        }