Exemplo n.º 1
0
 public ActionResult RegisterAsFaculty(FacultyRegistrationModel FacultyRegistration)
 {
     if (Session["UserId"] != null)
     {
         if (ModelState.IsValid)
         {
             int             UserId  = Convert.ToInt32(Session["UserId"].ToString());
             FacultyWorkInfo details = new FacultyWorkInfo();
             TryUpdateModel(details);
             details.FacultyUserId = Convert.ToInt64(Session["UserId"]);
             details.Status        = true;
             FacultyWorkInfoService.Create(details);
             View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
             UserManager.RemoveFromRole(Userdetails.AspnetUsersId, Userdetails.Role);
             UserManager.AddToRole(Userdetails.AspnetUsersId, "Alumni and Faculty");
             TempData["Success"] = UtilitiesClass.SuccessMessage;
             return(RedirectToAction("Profile", "Profile", new { area = "Alumini" }));
         }
         List <GraduationYear> _GraduationYears = new List <GraduationYear>();
         for (int i = 1970; i <= 2015; i++)
         {
             _GraduationYears.Add(new GraduationYear {
                 Year = "" + i, GraduationYearId = i
             });
         }
         FacultyRegistrationModel Faculty = new FacultyRegistrationModel()
         {
             GraduationYears = _GraduationYears,
         };
         return(View(Faculty));
     }
     return(RedirectToAction("Login", "Account", new { area = "" }));
 }
Exemplo n.º 2
0
        public ActionResult DeleteUserPost(int Id)
        {
            if (Session["UserId"] != null)
            {
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                UserPostService.Update(Id);
                TempData["DeletedMessage"] = UtilitiesClass.DeleteMessage;
                switch (Convert.ToInt32(Userdetails.RoleId))
                {
                case 1:
                    return(RedirectToAction(AlumniWhiteBoard.Index, AlumniWhiteBoard.WhiteBoard, new { area = AreasforAlumni.Alumini }));

                    break;

                case 2:
                    return(RedirectToAction(AlumniWhiteBoard.Index, AlumniWhiteBoard.WhiteBoard, new { area = AreasforAlumni.Faculty }));

                    break;

                default:
                    return(RedirectToAction(AlumniWhiteBoard.Index, AlumniWhiteBoard.WhiteBoard, new { area = AreasforAlumni.AlumniFaculty }));

                    break;
                }
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
Exemplo n.º 3
0
 public ActionResult Index()
 {
     if (Session["UserId"] != null)
     {
         List <Batches>         Batches     = new List <Batches>();
         int                    UserId      = Convert.ToInt32(Session["UserId"]);
         View_UserDetails       Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
         List <YearsforFaculty> Years       = new List <YearsforFaculty>();
         if (Userdetails.RoleId == "2")
         {
             for (int?i = Userdetails.WorkingFrom; i <= Userdetails.WorkingTo; i++)
             {
                 Years.Add(new YearsforFaculty {
                     Year = Convert.ToString(i)
                 });
             }
         }
         WhiteBoardModel WhiteBoard = new WhiteBoardModel()
         {
             Viewdetails     = Batches,
             RoleId          = Userdetails.RoleId,
             Batch           = Userdetails.Batch,
             Stream          = Userdetails.CourseName,
             Events          = EventCategoryService.GetCategorys(),
             yearsList       = Years,
             Coursecategorys = CategoryServices.GetAllCourseCategories(),
         };
         // ViewBag.Userdata = GenericMethods.GetUserdetailsonFaculty(UserId, Convert.ToString(Userdetails.Batch));
         return(View(WhiteBoard));
     }
     return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
 }
Exemplo n.º 4
0
        public List <Events> GetGoingUsers(int Eventid)
        {
            List <Events> Eventsusers = new List <Events>();

            using (var context = _dbContextFactory.CreateConnection())
            {
                List <Events> GoingUsers = (from a in context.Event_UserPayments
                                            join b in context.Event_UserSelections
                                            on a.UserSelectionId equals b.EventSelectionId
                                            where (b.EventId == Eventid && a.Status == true)
                                            select new Events {
                    UserId = a.UserId
                }).Distinct().Take(10).ToList();
                Def_Events Events = context.Def_Events.Where(x => x.EventId == Eventid && x.Status == true).FirstOrDefault();
                foreach (var GoingUsres in GoingUsers)
                {
                    View_UserDetails details = context.View_UserDetails.Where(x => x.UserId == GoingUsres.UserId).FirstOrDefault();
                    if (details.Batch != null)
                    {
                        Eventsusers.Add(new Events {
                            UserName = details.FirstName, LName = details.LastName, UserImage = details.ProfilePicture, Batch = details.Batch, Branch = details.CourseCategoryName, Course = details.CourseName
                        });
                    }
                    else
                    {
                        Eventsusers.Add(new Events {
                            UserName = details.FirstName, LName = details.LastName, UserImage = details.ProfilePicture, Batch = details.WorkingFrom, WorkingTO = details.WorkingTo, Course = details.DepartmentName
                        });
                    }
                }
            }
            return(Eventsusers);
        }
Exemplo n.º 5
0
        public ActionResult RegisterAsAlumni(StudentRegistrationModel StudentDetails)
        {
            if (Session["UserId"] != null)
            {
                if (ModelState.IsValid)
                {
                    string UserId = "";
                    UserId = Session["UserId"].ToString();
                    EducationalDetail details = new EducationalDetail();
                    TryUpdateModel(details);
                    details.UserId = Convert.ToInt64(Session["UserId"]);
                    details.Status = true;
                    EducationalDetailService.Create(details);

                    View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                    UserManager.RemoveFromRole(Userdetails.AspnetUsersId, Userdetails.Role);
                    UserManager.AddToRole(Userdetails.AspnetUsersId, "Alumni and Faculty");

                    return(RedirectToAction("UpdateProfile", "Home"));
                }
                StudentRegistrationModel userdto = new StudentRegistrationModel()
                {
                    Coursecategorys = CourseCategoryService.GetAllCourseCategories(),
                };
                return(View(userdto));
            }
            return(RedirectToAction("Login", "Account"));
        }
Exemplo n.º 6
0
        public List <Memroeis> GetMemories(int userid)
        {
            List <string>   MemoriesImages = new List <string>();
            List <Memroeis> UserImages     = new List <Memroeis>();

            using (var context = _dbContextFactory.CreateConnection())
            {
                List <Memroeis>  UserdetailsMemories = new List <Memroeis>();
                View_UserDetails Batch = context.View_UserDetails.Where(x => x.UserId == userid).FirstOrDefault();

                int?VisibleTo = Convert.ToInt32(Convert.ToInt32(Batch.Batch) - Convert.ToInt32(Batch.Years));

                List <Memroeis> Memories = (from a in context.db_Memories_Info
                                            join b in context.UserDetails
                                            on a.Userid equals b.Id
                                            where (a.Status == true && (a.VisibleBatchfrom == VisibleTo && a.VisibleBatchTo == Batch.Batch))
                                            select new Memroeis {
                    Userid = b.Id, Description = a.Description, PostedBy = b.FirstName + "" + b.LastName, Memoriesid = a.MemoriesId, Memoiesdate = a.MemoryDate, PostedOn = a.CreatedOn, PostedbyImages = b.ProfilePicture
                }).ToList();


                foreach (var Images in Memories)
                {
                    string MemoryImages = context.db_Memories_images.FirstOrDefault(x => x.MemoriesId == Images.Memoriesid).Image;

                    int Count = context.db_Memories_images.Where(x => x.MemoriesId == Images.Memoriesid).Count();

                    UserdetailsMemories.Add(new Memroeis {
                        Userid = Images.Userid, Memoriesid = Images.Memoriesid, ImagesCount = Count, PostedBy = Images.PostedBy, PostedOn = Images.PostedOn, Memoiesdate = Images.Memoiesdate, Description = Images.Description, ImagesFIles = MemoriesImages, PostedbyImages = Images.PostedbyImages, MemroyImage = MemoryImages
                    });
                }
                return(UserdetailsMemories);
            }
        }
Exemplo n.º 7
0
        public ActionResult PasswordChange(ChangePasswordModel ChangePassword)
        {
            if (Session["UserId"] != null)
            {
                View_UserDetails GetUserRolesCount = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(Session["UserId"]));


                if (ChangePassword.NewPassword.Length != 6)
                {
                    TempData["Successmessage"] = "Password must be 6 characters long";
                }
                else
                {
                    var hashedNewPassword = UserManager.ChangePassword(GetUserRolesCount.AspnetUsersId, ChangePassword.OldPassword, ChangePassword.NewPassword);
                    if (hashedNewPassword.Succeeded == false)
                    {
                        TempData["Successmessage"] = "invalid old password";
                    }
                    else
                    {
                        TempData["Successmessage"] = "Password Changed successfully";
                    }
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account", new { area = "" }));
            }
            return(View());
        }
Exemplo n.º 8
0
        public ActionResult Profile()
        {
            if (Session["UserId"] != null)
            {
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(Session["UserId"].ToString()));

                return(View(Userdetails));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
Exemplo n.º 9
0
        public ActionResult DonationStatus(int DonationId, int DonorId, string DonationStatus, string DonationAmount, string Comments)
        {
            decimal          Amount       = Convert.ToDecimal(DonationAmount);
            Donor_Details    data1        = DonationService.DonationStatus(DonationId, DonorId, Amount, DonationStatus, Comments);
            Donation_Details Donationdata = GenericMethods.GetUserDonations(DonationId);
            View_UserDetails UserDetails  = UserDetailsViewService.GetUserByUserId(DonorId);

            ViewBag.Amount        = data1.Donation_Amount;
            ViewBag.Date          = data1.CreatedOn;
            ViewBag.DonationTitle = Donationdata.Donation_Title;
            ViewBag.DonorName     = UserDetails.FirstName;

            return(View());
        }
Exemplo n.º 10
0
        public JsonResult GetPostsonLazyLoad(int?page)
        {
            var defaultPageSize = 5;

            int UserId = Convert.ToInt32(Session["UserId"]);
            View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));

            if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
            {
                var Data = GenericMethods.GetUserPostsonId(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, page, defaultPageSize);
                return(Json(Data, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 11
0
        public List <Images> getUserImages(int Userid)
        {
            List <Images> Images = new List <Images>();

            using (var context = _dbContextFactory.CreateConnection())
            {
                View_UserDetails Userdetails = context.View_UserDetails.Where(x => x.UserId == Userid).FirstOrDefault();
                var Educations = context.EducationalDetails.Where(x => x.Batch == Userdetails.Batch && x.Status == true && x.UserId != Userid).ToList();

                foreach (var data in Educations)
                {
                    UserDetail userdata = context.UserDetails.Where(x => x.Id == data.UserId).FirstOrDefault();
                    Images.Add(new Images {
                        Userid = data.UserId, Image = userdata.ProfilePicture, UserName = userdata.FirstName + userdata.LastName
                    });
                }
            }
            return(Images);
        }
Exemplo n.º 12
0
 public ActionResult SerachUsers(List <int> Userids)
 {
     try
     {
         View_UserDetails Users = new View_UserDetails();
         var products           = new System.Data.DataTable("teste");
         products.Columns.Add("Id", typeof(int));
         products.Columns.Add("FIrst Name", typeof(string));
         products.Columns.Add("Last Name", typeof(string));
         products.Columns.Add("Email", typeof(string));
         products.Columns.Add("Mobile", typeof(string));
         products.Columns.Add("Course Category", typeof(string));
         products.Columns.Add("Course", typeof(string));
         products.Columns.Add("Year", typeof(string));
         for (int i = 0; i < Userids.Count; i++)
         {
             Users = UserDetailsViewService.GetUserByUserId(Userids[i]);
             products.Rows.Add(Users.UserId, Users.FirstName, Users.LastName, Users.Email, Users.PhoneNumber, Users.CourseCategoryName, Users.CourseName, Users.Batch);
         }
         var grid = new GridView();
         grid.DataSource = products;
         grid.DataBind();
         Response.ClearContent();
         Response.AddHeader("content-disposition", "attachment; filename=AlumniDetails.xls");
         //Response.AddHeader("Content-Type", "application/vnd.ms-excel");
         Response.ContentType = "application/ms-excel";
         StringWriter   sw  = new StringWriter();
         HtmlTextWriter htw = new HtmlTextWriter(sw);
         grid.RenderControl(htw);
         Response.Write(sw.ToString());
         Response.End();
     }
     catch (SystemException ex)
     {
         TempData["Error"] = "Please check the users and Export";
         return(RedirectToAction("SerachUsers", "UserRegistrations", new { Area = "Admin" }));
     }
     return(View());
 }
Exemplo n.º 13
0
        public ActionResult AlumniProfile(int id)
        {
            View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(id);

            return(View(Userdetails));
        }
Exemplo n.º 14
0
        public ActionResult Index(WhiteBoardModel WhiteBoards, IEnumerable <HttpPostedFileBase> Images, IEnumerable <HttpPostedFileBase> Files)
        {
            var            defaultPageSize = 5;
            int?           Page            = 1;
            List <Batches> Batches         = new List <Batches>();

            if (Session["UserId"] != null)
            {
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                if (Userdetails.RoleId == "4")
                {
                    Batches.Add(new Batches {
                        Batch = "Visible To All", BatchName = "Visible To All"
                    });
                    Batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = "My BatchMates"
                    });
                }
                WhiteBoardModel WhiteBoard = new WhiteBoardModel()
                {
                    Viewdetails = Batches,
                    RoleId      = Userdetails.RoleId,
                    Batch       = Userdetails.Batch,
                    Stream      = Userdetails.CourseName,
                    Events      = EventCategoryService.GetCategorys()
                };


                if (ModelState.IsValid)
                {
                    int?EventId = null;
                    if (WhiteBoard.EventId == null || WhiteBoard.EventId == 0)
                    {
                        EventId = 5;
                    }
                    UserPost UserPosts = new UserPost()
                    {
                        EventId     = EventId,
                        UserId      = UserId,
                        UserMessage = WhiteBoards.Message,
                        ViewBy      = WhiteBoards.Batchyear,
                        Status      = true,
                        CreatedOn   = DateTime.Now
                    };
                    int    PostId    = UserPostService.InsertUserPosts(UserPosts);
                    string Batch     = "";
                    Int64  BatchFrom = 0;
                    Int64  BatchTo   = 0;
                    if (WhiteBoards.Batchyear == "Visible To All")
                    {
                        Batch = "Visible To All";
                    }
                    else
                    {
                        BatchFrom = Convert.ToInt64(WhiteBoards.Batchyear);
                        BatchTo   = Convert.ToInt64(WhiteBoards.Batchyear) - (Convert.ToInt64(Userdetails.Years));
                    }
                    if (Batch == "Visible To All")
                    {
                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId    = PostId,
                            Batch     = Batch,
                            Branch    = Userdetails.CourseCategoryName,
                            Degreee   = Userdetails.CourseId,
                            CreatedOn = DateTime.Now,
                            Status    = true
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }
                    else
                    {
                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId    = PostId,
                            Batch     = Convert.ToString(BatchTo),
                            BatchTo   = Convert.ToString(BatchFrom),
                            Branch    = Userdetails.CourseCategoryName,
                            Degreee   = Userdetails.CourseId,
                            CreatedOn = DateTime.Now,
                            Status    = true
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }


                    if (Images != null)
                    {
                        foreach (var Pictures in Images)
                        {
                            if (Pictures != null)
                            {
                                var fileName = Path.GetFileName(Pictures.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                                Pictures.SaveAs(path);
                                var             FilePath   = "/UserPostingImages/" + fileName;
                                UserPost_Images UserImages = new UserPost_Images()
                                {
                                    PostId    = PostId,
                                    ImagePath = FilePath,
                                    CreatedOn = DateTime.Now,
                                    Status    = true
                                };
                                UserpostPictureServices.Create(UserImages);
                            }
                        }
                    }
                    ViewBag.Userdata = GenericMethods.GetUserPostsonId(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, Page, defaultPageSize);
                    return(RedirectToAction("Index", "WhiteBoard", new { area = "AlumniFaculty" }));
                }
                return(View(WhiteBoard));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
Exemplo n.º 15
0
        public ActionResult PaymentGateway(int DonationId, int DonorId, string DonationStatus, string DonationAmount, string Comments)
        {
            decimal          Amount       = Convert.ToDecimal(DonationAmount);
            Donor_Details    data1        = DonationService.DonationStatus(DonationId, DonorId, Amount, DonationStatus, Comments);
            Donation_Details Donationdata = GenericMethods.GetUserDonations(DonationId);
            View_UserDetails UserDetails  = UserDetailsViewService.GetUserByUserId(DonorId);


            string hash_string = string.Empty;

            string[] hashVarsSeq;
            var      Key     = ConfigurationManager.AppSettings["MERCHANT_KEY"];
            Random   rnd     = new Random();
            string   strHash = Generatehash512(rnd.ToString() + DateTime.Now);

            txnid1 = strHash.ToString().Substring(0, 20);

            hashVarsSeq = ConfigurationManager.AppSettings["hashSequence"].Split('|'); // spliting hash sequence from config
            hash_string = "";
            foreach (string hash_var in hashVarsSeq)
            {
                if (hash_var == "key")
                {
                    hash_string = hash_string + ConfigurationManager.AppSettings["MERCHANT_KEY"];
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "txnid")
                {
                    hash_string = hash_string + txnid1;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "amount")
                {
                    hash_string = hash_string + Convert.ToDecimal(DonationAmount).ToString("g29");
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "productinfo")
                {
                    hash_string = hash_string + Donationdata.Donation_Title;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "firstname")
                {
                    hash_string = hash_string + UserDetails.FirstName;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "email")
                {
                    hash_string = hash_string + "*****@*****.**";
                    hash_string = hash_string + '|';
                }
                else
                {
                    hash_string = hash_string + (Request.Form[hash_var] != null ? Request.Form[hash_var] : "");// isset if else
                    hash_string = hash_string + '|';
                }
            }

            hash_string += ConfigurationManager.AppSettings["SALT"];                        // appending SALT
            hash1        = Generatehash512(hash_string).ToLower();                          //generating hash
            action1      = ConfigurationManager.AppSettings["PAYU_BASE_URL"] + "/_payment"; // setting URL

            System.Collections.Hashtable data = new System.Collections.Hashtable();         // adding values in gash table for data post
            data.Add("hash", hash1);
            data.Add("txnid", txnid1);
            data.Add("key", Key);
            string AmountForm = Convert.ToDecimal(DonationAmount).ToString("g29");// eliminating trailing zeros

            data.Add("amount", AmountForm);
            data.Add("firstname", UserDetails.FirstName);
            data.Add("email", "*****@*****.**");
            data.Add("phone", "8985143792");
            data.Add("productinfo", Donationdata.Donation_Title);
            data.Add("surl", "http://www.google.com");
            data.Add("furl", "http://www.google.com");

            string strForm = PreparePOSTForm(action1, data);

            ViewBag.Form = strForm;
            return(View());
        }
Exemplo n.º 16
0
        public ActionResult Index(WhiteBoardModel WhiteBoards, IEnumerable <HttpPostedFileBase> Images, IEnumerable <HttpPostedFileBase> Files)
        {
            if (Session["UserId"] != null)
            {
                List <YearsforFaculty> Years = new List <YearsforFaculty>();
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                List <Batches>   Batches     = new List <Batches>();
                int PostId = 0;
                if (ModelState.IsValid)
                {
                    if (WhiteBoards.selections == "Visible To All")
                    {
                        UserPost UserPosts = new UserPost()
                        {
                            EventId     = WhiteBoards.EventId,
                            ViewBy      = WhiteBoards.selections,
                            UserId      = UserId,
                            UserMessage = WhiteBoards.Message,
                            Status      = true,
                            CreatedOn   = DateTime.Now
                        };
                        PostId = UserPostService.InsertUserPosts(UserPosts);

                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId    = PostId,
                            Batch     = WhiteBoards.selections,
                            Branch    = WhiteBoards.Degree,
                            Degreee   = Userdetails.CourseId,
                            CreatedOn = DateTime.Now,
                            Status    = true,
                            BatchTo   = (WhiteBoards.WorkFromTo)
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }
                    else
                    {
                        UserPost UserPosts = new UserPost()
                        {
                            EventId     = WhiteBoards.EventId,
                            UserId      = UserId,
                            UserMessage = WhiteBoards.Message,
                            ViewBy      = WhiteBoards.Batchyear,
                            Status      = true,
                            CreatedOn   = DateTime.Now
                        };
                        PostId = UserPostService.InsertUserPosts(UserPosts);

                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId  = PostId,
                            Batch   = WhiteBoards.WorkFromYear,
                            Branch  = WhiteBoards.Degree,
                            Degreee = Userdetails.CourseId,

                            CreatedOn = DateTime.Now,
                            Status    = true,
                            BatchTo   = (WhiteBoards.WorkFromTo)
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }
                    if (Images != null)
                    {
                        foreach (var Pictures in Images)
                        {
                            if (Pictures != null)
                            {
                                var fileName = Path.GetFileName(Pictures.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                                Pictures.SaveAs(path);
                                var             FilePath   = "/UserPostingImages/" + fileName;
                                UserPost_Images UserImages = new UserPost_Images()
                                {
                                    PostId    = PostId,
                                    ImagePath = FilePath,
                                    CreatedOn = DateTime.Now,
                                    Status    = true
                                };
                                UserpostPictureServices.Create(UserImages);
                            }
                        }
                    }
                    ViewBag.Userdata = GenericMethods.GetUserdetailsonFaculty(UserId, Convert.ToString(Userdetails.Batch));
                    return(RedirectToAction("Index", "WhiteBoard", new { area = "Faculty" }));
                }

                if (Userdetails.RoleId == "2")
                {
                    for (int?i = Userdetails.WorkingFrom; i <= Userdetails.WorkingTo; i++)
                    {
                        Years.Add(new YearsforFaculty {
                            Year = Convert.ToString(i)
                        });
                    }
                }
                WhiteBoardModel WhiteBoard = new WhiteBoardModel()
                {
                    Viewdetails     = Batches,
                    RoleId          = Userdetails.RoleId,
                    Batch           = Userdetails.Batch,
                    Stream          = Userdetails.CourseName,
                    Events          = EventCategoryService.GetCategorys(),
                    yearsList       = Years,
                    Coursecategorys = CategoryServices.GetAllCourseCategories(),
                };
                ViewBag.Userdata = GenericMethods.GetUserdetailsonFaculty(UserId, Convert.ToString(Userdetails.Batch));
                return(View(WhiteBoard));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
Exemplo n.º 17
0
        public ActionResult Index(WhiteBoardModel WhiteBoards, IEnumerable <HttpPostedFileBase> Images, IEnumerable <HttpPostedFileBase> Files)
        {
            if (Session["UserId"] != null)
            {
                TempData["DeletedMessage"] = "your post successfully posted";
                int UserId = Convert.ToInt32(Session["UserId"]);

                List <Batches>   batches     = new List <Batches>();
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                switch (Convert.ToInt32(Userdetails.RoleId))
                {
                case 1:
                    batches.Add(new Batches {
                        Batch = UtilitiesClass.BatchVisibleToAll, BatchName = UtilitiesClass.BatchVisibleToAll
                    });
                    batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = UtilitiesClass.BatchName
                    });
                    break;

                case 2:
                    batches.Add(new Batches {
                        Batch = UtilitiesClass.BatchVisibleToAll, BatchName = UtilitiesClass.BatchVisibleToAll
                    });
                    batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = UtilitiesClass.BatchName
                    });
                    break;
                }
                if (Userdetails.RoleId == "4")
                {
                }
                WhiteBoardModel WhiteBoard = new WhiteBoardModel()
                {
                    Viewdetails = batches,
                    RoleId      = Userdetails.RoleId,
                    Batch       = Userdetails.Batch,
                    Stream      = Userdetails.CourseName,
                    Events      = EventCategoryService.GetCategorys()
                };

                if (ModelState.IsValid)
                {
                    int?EventId = null;
                    if (WhiteBoards.EventId == null || WhiteBoards.EventId == 0)
                    {
                        EventId = 5;
                    }
                    else
                    {
                        EventId = WhiteBoards.EventId;
                    }
                    UserPost UserPosts = new UserPost()
                    {
                        EventId     = EventId,
                        UserId      = UserId,
                        UserMessage = WhiteBoards.Message,
                        ViewBy      = WhiteBoards.Batchyear,
                        Status      = true,
                        CreatedOn   = DateTime.Now
                    };
                    int    PostId    = UserPostService.InsertUserPosts(UserPosts);
                    string Batch     = "";
                    Int64  BatchFrom = 0;
                    Int64  BatchTo   = 0;
                    if (WhiteBoards.Batchyear == UtilitiesClass.BatchVisibleToAll)
                    {
                        Batch = UtilitiesClass.BatchVisibleToAll;
                    }
                    else
                    {
                        BatchFrom = Convert.ToInt64(WhiteBoards.Batchyear);
                        BatchTo   = Convert.ToInt64(WhiteBoards.Batchyear) - (Convert.ToInt64(Userdetails.Years));
                    }
                    if (Batch == UtilitiesClass.BatchVisibleToAll)
                    {
                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId    = PostId,
                            Batch     = Batch,
                            Branch    = Userdetails.CourseCategoryName,
                            Degreee   = Userdetails.CourseId,
                            CreatedOn = DateTime.Now,
                            Status    = true
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }
                    else
                    {
                        UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                        {
                            PostId    = PostId,
                            Batch     = Convert.ToString(BatchTo),
                            BatchTo   = Convert.ToString(BatchFrom),
                            Branch    = Userdetails.CourseCategoryName,
                            Degreee   = Userdetails.CourseId,
                            CreatedOn = DateTime.Now,
                            Status    = true
                        };
                        UserPostVisibleServices.Create(UserPostVisible);
                    }


                    if (Images != null)
                    {
                        foreach (var Pictures in Images)
                        {
                            if (Pictures != null)
                            {
                                var fileName = Path.GetFileName(Pictures.FileName);
                                var path     = Path.Combine(Server.MapPath(UtilitiesClass.ImagePath + fileName));
                                Pictures.SaveAs(path);
                                var             FilePath   = "/UserPostingImages/" + fileName;
                                UserPost_Images UserImages = new UserPost_Images()
                                {
                                    PostId    = PostId,
                                    ImagePath = FilePath,
                                    CreatedOn = DateTime.Now,
                                    Status    = true
                                };
                                UserpostPictureServices.Create(UserImages);
                            }
                        }
                    }

                    return(RedirectToAction(AlumniWhiteBoard.Index, AlumniWhiteBoard.WhiteBoard, new { area = AreasforAlumni.Alumini }));
                }
                return(View(WhiteBoard));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
Exemplo n.º 18
0
        public ActionResult Index(int?Type)
        {
            var            defaultPageSize = 5;
            int?           page            = 1;
            List <Batches> batches         = new List <Batches>();

            if (Session["UserId"] != null)
            {
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                switch (Convert.ToInt32(Userdetails.RoleId))
                {
                case 1:
                    batches.Add(new Batches {
                        Batch = UtilitiesClass.BatchVisibleToAll, BatchName = UtilitiesClass.BatchVisibleToAll
                    });
                    batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = UtilitiesClass.BatchName
                    });
                    break;

                case 2:
                    batches.Add(new Batches {
                        Batch = UtilitiesClass.BatchVisibleToAll, BatchName = UtilitiesClass.BatchVisibleToAll
                    });
                    batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = UtilitiesClass.BatchName
                    });
                    break;
                }
                if (Userdetails.RoleId == "4")
                {
                }
                WhiteBoardModel WhiteBoard = new WhiteBoardModel()
                {
                    Viewdetails = batches,
                    RoleId      = Userdetails.RoleId,
                    Batch       = Userdetails.Batch,
                    Stream      = Userdetails.CourseName,
                    Events      = EventCategoryService.GetCategorys()
                };

                if (Type == 1)
                {
                    if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
                    {
                        ViewBag.Userdata = GenericMethods.GetUserDataserach(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, Type);
                    }
                }
                else if (Type == 2)
                {
                    if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
                    {
                        ViewBag.Userdata = GenericMethods.GetUserDataserach(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, Type);
                    }
                }
                else
                {
                    if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
                    {
                        ViewBag.Userdata = GenericMethods.GetUserPostsonId(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, page, defaultPageSize);
                    }
                }

                return(View(WhiteBoard));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
Exemplo n.º 19
0
        public ActionResult memories(MemoriesModel Model, IEnumerable <HttpPostedFileBase> Image)
        {
            if (Session["UserId"] != null)
            {
                List <Visible> visibleto = new List <Visible>();
                visibleto.Add(new Visible {
                    visibleTo = "To My Batch Mates"
                });
                visibleto.Add(new Visible {
                    visibleTo = "To All"
                });
                MemoriesModel model = new MemoriesModel()
                {
                    Visibleto = visibleto
                };

                if (Model.memoriesId != 0)
                {
                    View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(Session["UserId"]));

                    int?VisibleTo = 0;
                    if (Model.visible == "To My Batch Mates")
                    {
                        VisibleTo = Convert.ToInt32(Convert.ToInt32(Userdetails.Batch) - Convert.ToInt32(Userdetails.Years));
                    }
                    db_Memories_Info Mories = new db_Memories_Info()
                    {
                        Heading          = Model.Heading,
                        CreatedOn        = DateTime.Now,
                        Description      = Model.Description,
                        MemoryDate       = Model.date,
                        Userid           = Convert.ToInt64(Session["UserId"].ToString()),
                        Status           = true,
                        VisibleTo        = Model.visible,
                        VisibleBatchfrom = VisibleTo,
                        VisibleBatchTo   = Userdetails.Batch,
                        MemoriesId       = Model.memoriesId
                    };
                    db_Memories_Info InsertMemories = MermoriesServices.UpdateMemories(Mories);

                    if (Image != null)
                    {
                        foreach (var Images in Image)
                        {
                            if (Images != null)
                            {
                                var fileName = Path.GetFileName(Images.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                                Images.SaveAs(path);
                                var FilePath = "/UserPostingImages/" + fileName;
                                db_Memories_images images = new db_Memories_images()
                                {
                                    Image      = FilePath,
                                    CreatedOn  = DateTime.Now,
                                    MemoriesId = InsertMemories.MemoriesId,
                                    Status     = true,
                                };
                                MermoriesServices.InsertImages(images);
                            }
                        }
                    }
                    TempData["Message"] = "Memories Updated successfully...";
                    return(RedirectToAction("DisplayImages", "Memories", new { area = "Alumini", id = 1 }));
                }

                else
                {
                    if (ModelState.IsValid)
                    {
                        View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(Session["UserId"]));

                        int?VisibleTo = 0;
                        if (Model.visible == "To My Batch Mates")
                        {
                            VisibleTo = Convert.ToInt32(Convert.ToInt32(Userdetails.Batch) - Convert.ToInt32(Userdetails.Years));
                        }
                        db_Memories_Info Mories = new db_Memories_Info()
                        {
                            Heading          = Model.Heading,
                            CreatedOn        = DateTime.Now,
                            Description      = Model.Description,
                            MemoryDate       = Model.date,
                            Userid           = Convert.ToInt64(Session["UserId"].ToString()),
                            Status           = true,
                            VisibleTo        = Model.visible,
                            VisibleBatchfrom = VisibleTo,
                            VisibleBatchTo   = Userdetails.Batch
                        };
                        db_Memories_Info InsertMemories = MermoriesServices.Create(Mories);

                        if (Image != null)
                        {
                            foreach (var Images in Image)
                            {
                                var fileName = Path.GetFileName(Images.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                                Images.SaveAs(path);
                                var FilePath = "/UserPostingImages/" + fileName;
                                db_Memories_images images = new db_Memories_images()
                                {
                                    Image      = FilePath,
                                    CreatedOn  = DateTime.Now,
                                    MemoriesId = InsertMemories.MemoriesId,
                                    Status     = true,
                                };
                                MermoriesServices.InsertImages(images);
                            }
                        }
                        TempData["Message"] = "Your memories added successfully...";
                        return(RedirectToAction("DisplayImages", "Memories", new { area = "Alumini", id = 1 }));
                    }
                }
                return(View(model));
            }

            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }
Exemplo n.º 20
0
        public ActionResult PostasFaculty(WhiteBoardModel WhiteBoards, IEnumerable <HttpPostedFileBase> Images, IEnumerable <HttpPostedFileBase> Files)
        {
            int PostId = 0;

            if (Session["UserId"] != null)
            {
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                if (WhiteBoards.selections == "Visible To All")
                {
                    UserPost UserPosts = new UserPost()
                    {
                        EventId     = WhiteBoards.EventId,
                        UserId      = UserId,
                        UserMessage = WhiteBoards.Message,
                        ViewBy      = WhiteBoards.selections,
                        Status      = true,
                        CreatedOn   = DateTime.Now
                    };
                    PostId = UserPostService.InsertUserPosts(UserPosts);

                    UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                    {
                        PostId  = PostId,
                        Batch   = WhiteBoards.selections,
                        Branch  = WhiteBoards.Degree,
                        Degreee = Userdetails.CourseId,

                        CreatedOn = DateTime.Now,
                        Status    = true,
                        BatchTo   = (WhiteBoards.WorkFromTo)
                    };
                    UserPostVisibleServices.Create(UserPostVisible);
                }
                else
                {
                    UserPost UserPosts = new UserPost()
                    {
                        EventId     = WhiteBoards.EventId,
                        UserId      = UserId,
                        UserMessage = WhiteBoards.Message,
                        ViewBy      = WhiteBoards.Batchyear,
                        Status      = true,
                        CreatedOn   = DateTime.Now
                    };
                    PostId = UserPostService.InsertUserPosts(UserPosts);

                    UserPosts_Visisble UserPostVisible = new UserPosts_Visisble()
                    {
                        PostId  = PostId,
                        Batch   = WhiteBoards.WorkFromYear,
                        Branch  = WhiteBoards.Degree,
                        Degreee = Userdetails.CourseId,

                        CreatedOn = DateTime.Now,
                        Status    = true,
                        BatchTo   = (WhiteBoards.WorkFromTo)
                    };
                    UserPostVisibleServices.Create(UserPostVisible);
                }
                if (Images != null)
                {
                    foreach (var Pictures in Images)
                    {
                        if (Pictures != null)
                        {
                            var fileName = Path.GetFileName(Pictures.FileName);
                            var path     = Path.Combine(Server.MapPath("~/UserPostingImages/" + fileName));
                            Pictures.SaveAs(path);
                            var             FilePath   = "/UserPostingImages/" + fileName;
                            UserPost_Images UserImages = new UserPost_Images()
                            {
                                PostId    = PostId,
                                ImagePath = FilePath,
                                CreatedOn = DateTime.Now,
                                Status    = true
                            };
                            UserpostPictureServices.Create(UserImages);
                        }
                    }
                }
                return(RedirectToAction("Index", "WhiteBoard", new { area = "AlumniFaculty" }));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }