public ActionResult AddNotes()
        {
            AddNotes viewModel = new AddNotes
            {
                NoteCategoryList = dobj.NoteCategories.Where(x => x.IsActive == true).ToList(),
                NoteTypeList     = dobj.NoteTypes.Where(x => x.IsActive == true).ToList(),
                CountryList      = dobj.Countries.Where(x => x.IsActive == true).ToList()
            };

            return(View(viewModel));
        }
        public override int GetHashCode()
        {
            int hash = 1;

            hash ^= staffMembers_.GetHashCode();
            if (AddNotes.Length != 0)
            {
                hash ^= AddNotes.GetHashCode();
            }
            if (date_ != null)
            {
                hash ^= Date.GetHashCode();
            }
            return(hash);
        }
예제 #3
0
 public void AddTimingPointMarkers(GameSong song)
 {
     for (int index = 0; index < _beatlines.Length; index++)
     {
         if (!Players[index].Playing)
         {
             continue;
         }
         AddNotes.AddRange(song.AddNotes);
         var bl = _beatlines[index];
         GenerateStandardNotes(song, bl);
         GenerateSongEndNote(song, bl);
         GenerateBPMChangeNotes(song, bl);
         GenerateStopNotes(song, bl);
     }
 }
예제 #4
0
        /// <summary>
        /// Use some fancy calculations to determine how far the CPU player should be with an arrow sequence (from 0 to 1)
        /// for any specific moment in time.
        /// </summary>
        /// <param name="phraseNumber"></param>
        /// <returns></returns>
        public double GetPhraseDecimal(double phraseNumber)
        {
            int idx = -1;

            for (int x = 0; x < Players.Count(); x++)
            {
                if (!Players[x].IsCPUPlayer || !Players[x].Playing)
                {
                    continue;
                }
                idx = x;
                break;
            }
            if (idx == -1)
            {
                return(0.0);
            }
            //Are there any AddNotes in this song. They need to be considered as well.
            var addNotes = AddNotes.Where(e => e < phraseNumber).ToList();

            //Get the beatline note that was most recently passed, or the phrase number rounded down. Whichever is more recent.
            var lastNote = Math.Max(Math.Floor(phraseNumber), (addNotes.Any() ? addNotes.Max() : -1));

            //Get the nearest note not yet hit.
            var nextNote = NearestBeatlineNote(idx, phraseNumber);

            if (nextNote == null)
            {
                return(0.0);
            }

            var gap = nextNote.Position - lastNote;

            // Returns between 0 (at the last note) and 1 (at the next note).
            return((phraseNumber - lastNote) / gap);
        }
예제 #5
0
        public ActionResult AddNotes(int?id)
        {
            if (id != null)
            {
                SellerNotes noteobj = dbobj.SellerNotes.Where(x => x.ID == id).FirstOrDefault();
                AddNotes    editobj = new AddNotes();
                editobj.ID            = noteobj.ID;
                editobj.Title         = noteobj.Title;
                editobj.CategoryID    = noteobj.Category; //category id
                editobj.TypeID        = noteobj.NoteType;
                editobj.NumberOfPages = noteobj.NumberofPages;
                editobj.Description   = noteobj.Description;
                editobj.CountryID     = noteobj.Country; // country id
                editobj.InstituteName = noteobj.UniversityName;
                editobj.IsPaid        = noteobj.IsPaid;
                editobj.CourseName    = noteobj.Course;
                editobj.CourseCode    = noteobj.CourseCode;
                editobj.Professor     = noteobj.Professor;
                editobj.Price         = noteobj.SellingPrice;

                ViewBag.Category       = new SelectList(dbobj.NoteCategories, "ID", "Name");
                ViewBag.Type           = new SelectList(dbobj.NoteTypes, "ID", "Name");
                ViewBag.Country        = new SelectList(dbobj.Countries, "ID", "Name");
                ViewBag.ProfilePicture = dbobj.UserProfile.Where(x => x.UserID == noteobj.SellerID).Select(x => x.ProfilePicture).FirstOrDefault();
                return(View(editobj));
            }
            var   emailID = User.Identity.Name.ToString();
            Users obj     = dbobj.Users.Where(x => x.EmailID == emailID).FirstOrDefault();

            ViewBag.Category       = new SelectList(dbobj.NoteCategories, "ID", "Name");
            ViewBag.Type           = new SelectList(dbobj.NoteTypes, "ID", "Name");
            ViewBag.Country        = new SelectList(dbobj.Countries, "ID", "Name");
            ViewBag.ProfilePicture = dbobj.UserProfile.Where(x => x.UserID == obj.RoleID).Select(x => x.ProfilePicture).FirstOrDefault();

            return(View());
        }
        public ActionResult AddNotes(AddNotes add, string command)
        {
            if (add.UploadNotes[0] == null)
            {
                ModelState.AddModelError("UploadNotes", "This field is required");
                add.NoteCategoryList = dobj.NoteCategories.Where(x => x.IsActive == true).ToList();
                add.NoteTypeList     = dobj.NoteTypes.Where(x => x.IsActive == true).ToList();
                add.CountryList      = dobj.Countries.Where(x => x.IsActive == true).ToList();
                return(View(add));
            }

            if (add.IsPaid == true && add.NotesPreview == null)
            {
                ModelState.AddModelError("NotesPreview", "This field is required if selling type is paid");
                add.NoteCategoryList = dobj.NoteCategories.Where(x => x.IsActive == true).ToList();
                add.NoteTypeList     = dobj.NoteTypes.Where(x => x.IsActive == true).ToList();
                add.CountryList      = dobj.Countries.Where(x => x.IsActive == true).ToList();
                return(View(add));
            }
            foreach (HttpPostedFileBase file in add.UploadNotes)
            {
                if (!System.IO.Path.GetExtension(file.FileName).Equals(".pdf"))
                {
                    ModelState.AddModelError("UploadNotes", "Only PDF Format is allowed");
                    add.NoteCategoryList = dobj.NoteCategories.Where(x => x.IsActive == true).ToList();
                    add.NoteTypeList     = dobj.NoteTypes.Where(x => x.IsActive == true).ToList();
                    add.CountryList      = dobj.Countries.Where(x => x.IsActive == true).ToList();
                    return(View(add));
                }
            }
            if (ModelState.IsValid)
            {
                NoteDetail sellnote = new NoteDetail();

                Context.Users user = dobj.Users.FirstOrDefault(x => x.EmailID == User.Identity.Name);

                sellnote.SellerID       = user.ID;
                sellnote.Title          = add.Title;
                sellnote.Status         = command == "Save" ? 6 : 7;
                sellnote.Category       = add.Category;
                sellnote.NoteType       = add.NoteType;
                sellnote.NumberofPages  = add.NumberofPages;
                sellnote.Description    = add.Description;
                sellnote.UniversityName = add.UniversityName;
                sellnote.Country        = add.Country;
                sellnote.Course         = add.Course;
                sellnote.CourseCode     = add.CourseCode;
                sellnote.Professor      = add.Professor;
                sellnote.IsPaid         = add.IsPaid;
                if (sellnote.IsPaid)
                {
                    sellnote.SellingPrice = add.SellingPrice;
                }
                else
                {
                    sellnote.SellingPrice = 0;
                }

                if (sellnote.Status == 7)
                {
                    string sellername = user.FirstName + " " + user.LastName;
                    PublishNoteRequestmail(sellnote.Title, sellername);
                }


                sellnote.CreatedDate = DateTime.Now;
                sellnote.CreatedBy   = user.ID;
                sellnote.IsActive    = true;

                dobj.NoteDetail.Add(sellnote);
                dobj.SaveChanges();

                sellnote = dobj.NoteDetail.Find(sellnote.ID);
                if (add.DisplayPicture != null)
                {
                    string displaypicturefilename = System.IO.Path.GetFileName(add.DisplayPicture.FileName);
                    string displaypicturepath     = "~/Members/" + user.ID + "/" + sellnote.ID + "/";
                    NewDirectory(displaypicturepath);
                    string displaypicturefilepath = Path.Combine(Server.MapPath(displaypicturepath), displaypicturefilename);
                    sellnote.DisplayPicture = displaypicturepath + displaypicturefilename;
                    add.DisplayPicture.SaveAs(displaypicturefilepath);
                }

                if (add.NotesPreview != null)
                {
                    string notespreviewfilename = System.IO.Path.GetFileName(add.NotesPreview.FileName);
                    string notespreviewpath     = "~/Members/" + user.ID + "/" + sellnote.ID + "/";
                    NewDirectory(notespreviewpath);
                    string notespreviewfilepath = Path.Combine(Server.MapPath(notespreviewpath), notespreviewfilename);
                    sellnote.NotesPreview = notespreviewpath + notespreviewfilename;
                    add.NotesPreview.SaveAs(notespreviewfilepath);
                }

                dobj.NoteDetail.Attach(sellnote);
                dobj.Entry(sellnote).Property(x => x.DisplayPicture).IsModified = true;
                dobj.Entry(sellnote).Property(x => x.NotesPreview).IsModified   = true;
                dobj.SaveChanges();

                foreach (HttpPostedFileBase file in add.UploadNotes)
                {
                    if (file != null)
                    {
                        string notesattachementfilename = System.IO.Path.GetFileName(file.FileName);
                        string notesattachementpath     = "~/Members/" + user.ID + "/" + sellnote.ID + "/Attachements/";
                        NewDirectory(notesattachementpath);
                        string notesattachementfilepath = Path.Combine(Server.MapPath(notesattachementpath), notesattachementfilename);
                        file.SaveAs(notesattachementfilepath);

                        NotesAttachments notesattachements = new NotesAttachments
                        {
                            NoteID      = sellnote.ID,
                            FileName    = notesattachementfilename,
                            FilePath    = notesattachementpath,
                            CreatedDate = DateTime.Now,
                            CreatedBy   = user.ID,
                            IsActive    = true
                        };

                        dobj.NotesAttachments.Add(notesattachements);
                        dobj.SaveChanges();
                    }
                }

                return(RedirectToAction("Dashboard", "SellNotes"));
            }
            else
            {
                AddNotes viewModel = new AddNotes
                {
                    NoteCategoryList = dobj.NoteCategories.Where(x => x.IsActive == true).ToList(),
                    NoteTypeList     = dobj.NoteTypes.Where(x => x.IsActive == true).ToList(),
                    CountryList      = dobj.Countries.Where(x => x.IsActive == true).ToList()
                };

                return(View(viewModel));
            }
        }