コード例 #1
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());
        }
コード例 #2
0
ファイル: WhiteBoardController.cs プロジェクト: Zoninn/Alumni
 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 = "" }));
 }
コード例 #3
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 = "" }));
 }
コード例 #4
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"));
        }
コード例 #5
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 = "" }));
        }
コード例 #6
0
        public ActionResult Members()
        {
            UserMembersModel users = new UserMembersModel()
            {
                GetUsers = UserDetailsViewService.GetAllUsers()
            };

            return(View(users));
        }
コード例 #7
0
        public JsonResult SENDEmail(int userid, string Message, string Heading, string Subject, int Status)
        {
            var Result = UserDetailsViewService.GetUserByUserId(userid);

            Emails.SendEmails(Result.Email, Message, Result.FirstName + Result.LastName, Heading, Subject);
            var Data = "";

            return(Json(Data, JsonRequestBehavior.DenyGet));
        }
コード例 #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 = "" }));
        }
コード例 #9
0
 public ActionResult Members()
 {
     if (Session["UserId"] != null)
     {
         UserMembersModel users = new UserMembersModel()
         {
             GetUsers        = UserDetailsViewService.GetAllUsers(),
             Coursecategorys = CourseCategoryService.GetAllCourseCategories(),
         };
         return(View(users));
     }
     return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
 }
コード例 #10
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());
        }
コード例 #11
0
        public ActionResult UpdateAlumni()
        {
            if (Session["UserId"] != null)
            {
                StudentRegistrationModel userdto = null;
                int UserId = Convert.ToInt32(Session["UserId"].ToString());
                List <EducationdetailsDTO> educationdetails = EducationalDetailService.GetEducationdetails(UserId);
                List <GraduationYear>      _GraduationYears = new List <GraduationYear>();
                for (int i = 1970; i <= 2015; i++)
                {
                    _GraduationYears.Add(new GraduationYear {
                        Year = "" + i, GraduationYearId = i
                    });
                }
                foreach (var educationdetail in educationdetails)
                {
                    userdto = new StudentRegistrationModel()
                    {
                        CourseId         = educationdetail.CourseId,
                        CourseCategoryId = educationdetail.CategoryId,
                        Batch            = educationdetail.Batch,

                        Coursecategorys = CourseCategoryService.GetAllCourseCategories(),
                    };
                }
                int?RoleId = null;

                List <View_UserDetails> GetUserRolesCount = UserDetailsViewService.GetUserRolesCount(UserId);

                foreach (var Roles in GetUserRolesCount)
                {
                    RoleId = Convert.ToInt32(Roles.RoleId);
                }
                if (RoleId == 1)
                {
                    return(View(userdto));
                }
                else if (RoleId == 2)
                {
                    return(RedirectToAction("UpdateFaculty", "Profile"));
                }
                else if (RoleId == 4)
                {
                    return(RedirectToAction("ViewAllDetails", "Profile"));
                }
            }
            return(RedirectToAction("Login", "Account", new { area = "" }));
        }
コード例 #12
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);
            }
        }
コード例 #13
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());
 }
コード例 #14
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 = "" }));
        }
コード例 #15
0
        public JsonResult GetUserImages()
        {
            var Data = UserDetailsViewService.GetAllUsers();

            return(Json(Data, JsonRequestBehavior.AllowGet));
        }
コード例 #16
0
        public ActionResult AlumniProfile(int id)
        {
            View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(id);

            return(View(Userdetails));
        }
コード例 #17
0
        public JsonResult GetUserprofile(int Userid)
        {
            var Userdetails = UserDetailsViewService.GetUserByUserId(Userid);

            return(Json(Userdetails, JsonRequestBehavior.AllowGet));
        }
コード例 #18
0
        public JsonResult GetUserdetailsonId(int Userid)
        {
            var Data = UserDetailsViewService.GetUserByUserId(Userid);

            return(Json(Data, JsonRequestBehavior.AllowGet));
        }
コード例 #19
0
        public JsonResult GetUsers(int Role, int UserStatus)
        {
            IEnumerable <View_UserDetails> model = UserDetailsViewService.GetAllUserDetailsByUserRoleAndStatus(Role, UserStatus);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
コード例 #20
0
        public JsonResult EmailSearch(string Email, int id)
        {
            var Data = UserDetailsViewService.GetEmailsonEmailsearch(Email, id);

            return(Json(Data, JsonRequestBehavior.AllowGet));
        }
コード例 #21
0
        public JsonResult GetsearchbasedonCourse(string Coursecategory, string Course, string Year)
        {
            var Data = UserDetailsViewService.GetUserserachoncourse(Coursecategory, Course, Year);

            return(Json(Data, JsonRequestBehavior.AllowGet));
        }
コード例 #22
0
        public JsonResult GetUsersonserach(string Degree, string Course, int?Batch, int?Userid)
        {
            var data = UserDetailsViewService.GetAllDetailsonserachbyAdmin(Degree, Course, Convert.ToInt32(Batch), Userid);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
コード例 #23
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 = "" }));
        }
コード例 #24
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());
        }
コード例 #25
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 = "" }));
        }
コード例 #26
0
ファイル: WhiteBoardController.cs プロジェクト: Zoninn/Alumni
        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 = "" }));
        }
コード例 #27
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 = "" }));
        }
コード例 #28
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 = "" }));
        }