コード例 #1
0
        public ActionResult InReview(int id)
        {
            SellerNote sellrnote = dbobj.SellerNotes.Find(id);

            if (sellrnote != null && sellrnote.Referencedata.value == "submitted for review")
            {
                sellrnote.Status = dbobj.Referencedatas.Where(x => x.RefCategory.ToLower() == "note status" && x.value.ToLower() == "in review").Select(x => x.Id).FirstOrDefault();
            }
            dbobj.Entry(sellrnote).State = EntityState.Modified;
            dbobj.SaveChanges();
            return(RedirectToAction("AdminDashboard", "Admin"));
        }
コード例 #2
0
        public ActionResult Register([Bind(Exclude = "IsEmailVerified")] UserRegistration user)
        {
            bool   status  = false;
            string message = "";

            //model validation
            if (ModelState.IsValid)
            {
                //email is already exist
                var isExist = IsEmailExist(user.EmailId);
                if (isExist)
                {
                    ModelState.AddModelError("EmailExist", "Email already exist");
                    return(View(user));
                }
                //Password Hashing
                user.Password        = Crypto.Hash(user.Password);
                user.ConfirmPassword = Crypto.Hash(user.ConfirmPassword); //

                user.IsEmailVerified = false;


                UserRole objrole = dbObj.UserRoles.Where(x => x.Name.ToLower() == "member").FirstOrDefault();

                User objUser = new User
                {
                    RoleID      = objrole.ID,
                    FirstName   = user.FirstName,
                    LastName    = user.LastName,
                    EmailId     = user.EmailId,
                    Password    = user.Password,
                    CreatedDate = DateTime.Now,
                    IsActive    = true
                };

                var userName = user.FirstName.ToString();


                dbObj.Users.Add(objUser);
                dbObj.SaveChanges();
                //Send Email to User
                SystemConfiguration system  = dbObj.SystemConfigurations.Where(x => x.Key == "SupportEmail").FirstOrDefault();
                SystemConfiguration system1 = dbObj.SystemConfigurations.Where(x => x.Key == "Password").FirstOrDefault();


                SendVerificationLinkEmail(user.EmailId.ToString(), system.Value, system1.Value);
                message = "Registration successfully done. Account activation link " +
                          " has been sent to your email id:" + user.EmailId;
            }
            ViewBag.Message = message;
            ViewBag.Status  = Status;
            return(View(user));
        }
コード例 #3
0
        public ActionResult Delete(int id)
        {
            var del = (from report in dbobj.SellerNotesReportedIssues where report.NoteId == id select report).FirstOrDefault();

            dbobj.SellerNotesReportedIssues.Remove(del);
            dbobj.SaveChanges();
            return(RedirectToAction("SpamReport"));
        }
コード例 #4
0
        public ActionResult DeleteReview(int id)
        {
            var del = (from report in dbobj.SellerNotesReviews where report.NoteId == id select report).FirstOrDefault();

            dbobj.SellerNotesReviews.Remove(del);
            dbobj.SaveChanges();
            return(RedirectToAction("AdminDashboard", "Admin"));
        }
コード例 #5
0
        public ActionResult Review(int id, string comments, int rate)
        {
            Download          objdownload = dbobj.Downloads.Where(x => x.NoteId == id).FirstOrDefault();
            var               Emailid     = User.Identity.Name.ToString();
            User              user        = dbobj.Users.Where(x => x.EmailId == Emailid).FirstOrDefault();
            SellerNote        sellrnote   = dbobj.SellerNotes.Where(x => x.Id == id).FirstOrDefault();
            SellerNotesReview objseller   = dbobj.SellerNotesReviews.Where(x => x.NoteId == sellrnote.Id && x.ReviewedByid == user.ID).FirstOrDefault();

            if (objseller != null)
            {
                objseller.Ratings            = rate;
                objseller.Comments           = comments;
                objseller.ModifiedBy         = user.ID;
                objseller.Modifieddate       = DateTime.Now;
                dbobj.Entry(objseller).State = EntityState.Modified;
                dbobj.SaveChanges();
            }
            else
            {
                SellerNotesReview objseller1 = new SellerNotesReview
                {
                    NoteId             = sellrnote.Id,
                    Ratings            = rate,
                    Comments           = comments,
                    ReviewedByid       = user.ID,
                    AgainstDownloadsId = objdownload.Id,
                    CreatedBy          = objdownload.downloader,
                    CreatedDate        = DateTime.Now,
                    IsActive           = true
                };
                dbobj.SellerNotesReviews.Add(objseller1);
                dbobj.SaveChanges();
            }

            return(RedirectToAction("Dashboard", "Notes"));
        }
コード例 #6
0
        public ActionResult Deactivate(int id)
        {
            var  Emailid = User.Identity.Name.ToString();
            User user    = dbobj.Users.Where(x => x.EmailId == Emailid).FirstOrDefault();
            User objuser = dbobj.Users.Where(x => x.ID == id).FirstOrDefault();

            objuser.IsActive           = false;
            dbobj.Entry(objuser).State = EntityState.Modified;
            dbobj.SaveChanges();

            var sellerNote = dbobj.SellerNotes.Where(x => x.SellerID == id && x.Referencedata.RefCategory.ToLower() == "note status" && x.Referencedata.value.ToLower() == "published").ToList();

            foreach (var i in sellerNote)
            {
                i.Status             = dbobj.Referencedatas.Where(x => x.RefCategory.ToLower() == "note status" && x.value.ToLower() == "removed").Select(x => x.Id).FirstOrDefault();
                i.ModifiedBy         = user.ID;
                i.ModifiedDate       = DateTime.Now;
                i.ActionedBy         = user.ID;
                dbobj.Entry(i).State = EntityState.Modified;
            }
            dbobj.SaveChanges();
            return(RedirectToAction("AdminDashboard", "Admin"));
        }
コード例 #7
0
        public ActionResult ManageSystemConfiguration(Managesystem managesystem)
        {
            var  Emailid = User.Identity.Name.ToString();
            User user    = dbobj.Users.Where(x => x.EmailId == Emailid).FirstOrDefault();

            if (ModelState.IsValid)
            {
                SystemConfiguration systemConfiguration1 = new SystemConfiguration()
                {
                    Key          = "SupportEmail",
                    Value        = managesystem.SupportEmailid,
                    CreatedBy    = user.ID,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    isActive     = true,
                };
                dbobj.SystemConfigurations.Add(systemConfiguration1);
                dbobj.SaveChanges();

                SystemConfiguration systemConfiguration = new SystemConfiguration()
                {
                    Key          = "Password",
                    Value        = managesystem.Password,
                    CreatedBy    = user.ID,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    isActive     = true,
                };
                dbobj.SystemConfigurations.Add(systemConfiguration);
                dbobj.SaveChanges();
                SystemConfiguration systemConfiguration2 = new SystemConfiguration()
                {
                    Key          = "SupportPhoneNumber",
                    Value        = managesystem.PhoneNumber,
                    CreatedBy    = user.ID,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    isActive     = true,
                };
                dbobj.SystemConfigurations.Add(systemConfiguration2);
                dbobj.SaveChanges();
                SystemConfiguration systemConfiguration3 = new SystemConfiguration()
                {
                    Key          = "EmailAddress",
                    Value        = managesystem.EmailAddress,
                    CreatedBy    = user.ID,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    isActive     = true,
                };
                dbobj.SystemConfigurations.Add(systemConfiguration3);
                dbobj.SaveChanges();
                SystemConfiguration systemConfiguration4 = new SystemConfiguration()
                {
                    Key          = "Facebook URL",
                    Value        = managesystem.Facebook,
                    CreatedBy    = user.ID,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    isActive     = true,
                };
                dbobj.SystemConfigurations.Add(systemConfiguration4);
                dbobj.SaveChanges();
                SystemConfiguration systemConfiguration5 = new SystemConfiguration()
                {
                    Key          = "Twitter URL",
                    Value        = managesystem.Twitter,
                    CreatedBy    = user.ID,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    isActive     = true,
                };
                dbobj.SystemConfigurations.Add(systemConfiguration5);
                dbobj.SaveChanges();
                SystemConfiguration systemConfiguration6 = new SystemConfiguration()
                {
                    Key          = "Linkedin URL",
                    Value        = managesystem.Linkedin,
                    CreatedBy    = user.ID,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    isActive     = true,
                };
                dbobj.SystemConfigurations.Add(systemConfiguration6);
                dbobj.SaveChanges();
                SystemConfiguration systemConfiguration7 = new SystemConfiguration()
                {
                    Key          = "DefaultImageforNote",
                    CreatedBy    = user.ID,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    isActive     = true,
                };
                string storepath = Server.MapPath("/System Configuration/DefaultImage/");
                if (managesystem.DisplayPicture != null && managesystem.DisplayPicture.ContentLength > 0)
                {
                    string _FileName = Path.GetFileNameWithoutExtension(managesystem.DisplayPicture.FileName);
                    string extension = Path.GetExtension(managesystem.DisplayPicture.FileName);
                    _FileName = "DN" + extension;
                    string finalpath = Path.Combine(storepath, _FileName);
                    managesystem.DisplayPicture.SaveAs(finalpath);
                    systemConfiguration7.Value = Path.Combine(("/System Configuration/DefaultImage/"), _FileName);
                    dbobj.SystemConfigurations.Add(systemConfiguration7);
                    dbobj.SaveChanges();
                }
                SystemConfiguration systemConfiguration8 = new SystemConfiguration()
                {
                    Key          = "DefaultProfilePicture",
                    CreatedBy    = user.ID,
                    CreatedDate  = DateTime.Now,
                    ModifiedDate = DateTime.Now,
                    isActive     = true,
                };
                string storepath1 = Server.MapPath("/System Configuration/DefaultImage/");
                if (managesystem.ProfilePicture != null && managesystem.ProfilePicture.ContentLength > 0)
                {
                    string _FileName1 = Path.GetFileNameWithoutExtension(managesystem.ProfilePicture.FileName);
                    string extension1 = Path.GetExtension(managesystem.ProfilePicture.FileName);
                    _FileName1 = "DP" + extension1;
                    string finalpath1 = Path.Combine(storepath1, _FileName1);
                    managesystem.ProfilePicture.SaveAs(finalpath1);
                    systemConfiguration8.Value = Path.Combine(("/System Configuration/DefaultImage/"), _FileName1);
                    dbobj.SystemConfigurations.Add(systemConfiguration8);
                    dbobj.SaveChanges();
                }
            }

            return(RedirectToAction("AdminDashboard", "Admin"));
        }
コード例 #8
0
        public ActionResult userprofile(Userprofilee user1)
        {
            var  Emailid = User.Identity.Name.ToString();
            User user    = dbobj.Users.Where(x => x.EmailId == Emailid).FirstOrDefault();

            if (ModelState.IsValid)
            {
                UserProfile userprofile1 = dbobj.UserProfiles.Where(x => x.UserId == user1.UserId).FirstOrDefault();
                if (userprofile1 != null)
                {
                    userprofile1.DOB    = user1.DOB;
                    userprofile1.Gender = user1.Gender;
                    userprofile1.Phonenumbercountrycode = user1.Phonenumbercountrycode;
                    userprofile1.PhoneNumber            = user1.PhoneNumber;
                    userprofile1.AddressLine1           = user1.AddressLine1;
                    userprofile1.AddressLine2           = user1.AddressLine2;
                    userprofile1.City         = user1.City;
                    userprofile1.State        = user1.State;
                    userprofile1.ZipCode      = user1.ZipCode;
                    userprofile1.Country      = user1.Country;
                    userprofile1.University   = user1.University;
                    userprofile1.College      = user1.College;
                    userprofile1.ModifiedDate = DateTime.Now;
                    userprofile1.ModifiedBy   = user.ID;
                    userprofile1.IsActive     = true;
                    //display picture
                    //generate path to store image
                    string storepath = Path.Combine(Server.MapPath("/UploadFiles/" + user.ID));
                    //check for directory, if not exist ,then create it
                    if (!Directory.Exists(storepath))
                    {
                        Directory.CreateDirectory(storepath);
                    }


                    if (user1.ProfilePicture != null && user1.ProfilePicture.ContentLength > 0)
                    {
                        string _FileName = Path.GetFileNameWithoutExtension(user1.ProfilePicture.FileName);
                        string extension = Path.GetExtension(user1.ProfilePicture.FileName);
                        _FileName = "DP_" + DateTime.Now.ToString("yymmssfff") + extension;
                        string finalpath = Path.Combine(storepath, _FileName);
                        user1.ProfilePicture.SaveAs(finalpath);


                        userprofile1.ProfilePicture = Path.Combine(("/UploadFiles/" + user.ID + "/"), _FileName);
                        dbobj.SaveChanges();
                    }
                    else
                    {
                        userprofile1.ProfilePicture = "/System Configuration/DefaultImage/user-1.jpg";
                        dbobj.SaveChanges();
                    }
                    dbobj.Entry(userprofile1).State = EntityState.Modified;
                    dbobj.SaveChanges();
                }

                else
                {
                    UserProfile userprofile = new UserProfile
                    {
                        UserId = user.ID,
                        DOB    = user1.DOB,
                        Gender = user1.Gender,
                        Phonenumbercountrycode = user1.Phonenumbercountrycode,
                        PhoneNumber            = user1.PhoneNumber,
                        AddressLine1           = user1.AddressLine1,
                        AddressLine2           = user1.AddressLine2,
                        City        = user1.City,
                        State       = user1.State,
                        ZipCode     = user1.ZipCode,
                        Country     = user1.Country,
                        University  = user1.University,
                        College     = user1.College,
                        CreatedDate = DateTime.Now,
                        CreatedBy   = user.ID,
                        IsActive    = true
                    };
                    //Profile picture
                    //generate path to store image
                    string storepath = Path.Combine(Server.MapPath("/UploadFiles/" + user.ID));
                    //check for directory, if not exist ,then create it
                    if (!Directory.Exists(storepath))
                    {
                        Directory.CreateDirectory(storepath);
                    }
                    if (user1.ProfilePicture != null && user1.ProfilePicture.ContentLength > 0)
                    {
                        string _FileName = Path.GetFileNameWithoutExtension(user1.ProfilePicture.FileName);
                        string extension = Path.GetExtension(user1.ProfilePicture.FileName);
                        _FileName = "DP_" + DateTime.Now.ToString("yymmssfff") + extension;
                        string finalpath = Path.Combine(storepath, _FileName);
                        user1.ProfilePicture.SaveAs(finalpath);
                        userprofile.ProfilePicture = Path.Combine(("/UploadFiles/" + user.ID + "/"), _FileName);
                        dbobj.SaveChanges();
                    }
                    else
                    {
                        userprofile.ProfilePicture = "/System Configuration/DefaultImage/user-1.jpg";
                        dbobj.SaveChanges();
                    }
                    dbobj.UserProfiles.Add(userprofile);
                    dbobj.SaveChanges();
                }
            }
            ViewBag.Gender      = dbobj.Referencedatas.Where(x => x.isActive == true && x.RefCategory == "Gender");
            ViewBag.Country     = dbobj.Countries.Where(x => x.isActive == true);
            ViewBag.countrycode = dbobj.Countries.Where(x => x.isActive == true);
            return(RedirectToAction("Searchnote", "Notes"));

            return(View(user1));
        }
コード例 #9
0
        public ActionResult addnotes(UserSellernotes note)
        {
            if (ModelState.IsValid)
            {
                var           Emailid       = User.Identity.Name.ToString();
                User          user          = dbobj.Users.Where(x => x.EmailId == Emailid).FirstOrDefault();
                Referencedata rf            = dbobj.Referencedatas.Where(x => x.RefCategory.ToLower() == "note status").FirstOrDefault();
                SellerNote    objsellernote = new SellerNote
                {
                    SellerID       = user.ID,
                    Status         = rf.Id,
                    Title          = note.Title,
                    Category       = note.Category,
                    NoteType       = note.NoteType,
                    Professor      = note.Professor,
                    Description    = note.Description,
                    IsPaid         = note.IsPaid,
                    NumberofPages  = note.NumberofPages,
                    UniversityName = note.UniversityName,
                    Country        = note.Country,
                    Course         = note.Course,
                    CourseCode     = note.CourseCode,
                    SellingPrice   = note.SellingPrice,
                    CreatedDate    = DateTime.Now,
                    IsActive       = true
                };
                dbobj.SellerNotes.Add(objsellernote);
                dbobj.SaveChanges();
                var noteID = objsellernote.Id;
                //display picture
                //generate path to store image
                string storepath = Path.Combine(Server.MapPath("/UploadFiles/" + user.ID), noteID.ToString());
                //check for directory, if not exist ,then create it
                if (!Directory.Exists(storepath))
                {
                    Directory.CreateDirectory(storepath);
                }
                if (note.DisplayPicture != null && note.DisplayPicture.ContentLength > 0)
                {
                    string _FileName = Path.GetFileNameWithoutExtension(note.DisplayPicture.FileName);
                    string extension = Path.GetExtension(note.DisplayPicture.FileName);
                    _FileName = "DP_" + DateTime.Now.ToString("yymmssfff") + extension;
                    string finalpath = Path.Combine(storepath, _FileName);
                    note.DisplayPicture.SaveAs(finalpath);
                    objsellernote.DisplayPicture = Path.Combine(("/UploadFiles/" + user.ID + "/" + noteID + "/"), _FileName);
                    dbobj.SaveChanges();
                }
                else
                {
                    objsellernote.DisplayPicture = "/System Configuration/DefaultImage/4.jpg";
                    dbobj.SaveChanges();
                }
                //upload notes
                string storeuploadpath = Path.Combine(storepath, "Attachments");
                //check for directory, if not exist ,then create it
                if (!Directory.Exists(storeuploadpath))
                {
                    Directory.CreateDirectory(storeuploadpath);
                }
                SellerNotesAttachement objsellernoteattachment = new SellerNotesAttachement
                {
                    NoteID      = noteID,
                    IsActive    = true,
                    CreatedBy   = user.ID,
                    Createddate = DateTime.Now
                };
                //
                int count = 1;
                var UploadnoteFilePath = "";
                var UploadnoteFileName = "";
                foreach (var File in note.UploadNotes)
                {
                    string _FileName = Path.GetFileNameWithoutExtension(File.FileName);
                    string extension = Path.GetExtension(File.FileName);
                    _FileName = "Attachment" + count + "_" + DateTime.Now.ToString("ddmyyyy") + extension;
                    string finalpath = Path.Combine(storeuploadpath, _FileName);
                    File.SaveAs(finalpath);
                    UploadnoteFileName += _FileName + ";";
                    UploadnoteFilePath += Path.Combine(("/UploadFiles/" + user.ID + "/" + noteID + "/Attachment/"), _FileName);
                    count++;
                }
                objsellernoteattachment.FileName = UploadnoteFileName;
                objsellernoteattachment.FilePath = UploadnoteFilePath;
                dbobj.SellerNotesAttachements.Add(objsellernoteattachment);
                dbobj.SaveChanges();
                //notes preview
                if (note.IsPaid == true)
                {
                    if (note.NotesPreview == null)
                    {
                        ViewBag.ErrorMessage = "plz upload preview";
                        ViewBag.NoteCategory = dbobj.NoteCategories.Where(x => x.isActive == true);
                        ViewBag.NoteType     = dbobj.NoteTypes.Where(x => x.IsActive == true);
                        ViewBag.Country      = dbobj.Countries.Where(x => x.isActive == true);
                        return(View(note));
                    }
                }

                if (note.NotesPreview != null && note.NotesPreview.ContentLength > 0)
                {
                    string _FileName = Path.GetFileNameWithoutExtension(note.NotesPreview.FileName);
                    string extension = Path.GetExtension(note.NotesPreview.FileName);
                    _FileName = "Preview_" + DateTime.Now.ToString("yymmssfff") + extension;
                    string finalpath = Path.Combine(storepath, _FileName);
                    note.NotesPreview.SaveAs(finalpath);
                    objsellernote.NotesPreview = Path.Combine(("/UploadFiles/" + user.ID + "/" + noteID + "/"), _FileName);
                    dbobj.SaveChanges();
                }
                return(RedirectToAction("Dashboard", "Notes"));
            }

            ViewBag.NoteCategory = dbobj.NoteCategories.Where(x => x.isActive == true);
            ViewBag.NoteType     = dbobj.NoteTypes.Where(x => x.IsActive == true);
            ViewBag.Country      = dbobj.Countries.Where(x => x.isActive == true);
            return(View(note));
        }