Ejemplo n.º 1
0
        public ActionResult Payments()
        {
            List <ViewModelConference> results = new List <ViewModelConference>();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var conferences = entity.Conferences.ToList();
                foreach (var item in conferences)
                {
                    ViewModelConference newConf = new ViewModelConference();
                    newConf.PaperSubActive = false;
                    if (item.PaperSubStartDate <= DateTime.Now && item.PaperSubEndDate >= DateTime.Now)
                    {
                        newConf.PaperSubActive = true;
                    }

                    //fill the properties
                    newConf.ConferenceId      = item.ConferenceId;
                    newConf.Name              = item.Name;
                    newConf.StartDate         = item.StartDate;
                    newConf.EndDate           = item.EndDate;
                    newConf.PaperSubStartDate = item.PaperSubStartDate;
                    newConf.PaperSubEndDate   = item.PaperSubEndDate;

                    results.Add(newConf);
                }
            }
            return(View(results));
        }
Ejemplo n.º 2
0
        public ActionResult Index(string id)
        {
            ViewData["Role"] = id;
            List <ViewModelUser> results = new List <ViewModelUser>();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var users = entity.Users.Where(c => c.Role == id).ToList();
                foreach (var item in users)
                {
                    ViewModelUser result = new ViewModelUser();
                    result.UserId        = item.UserId;
                    result.Email         = item.Email;
                    result.Password      = item.Password;
                    result.Salt          = item.Salt;
                    result.Role          = item.Role;
                    result.FirstName     = item.FirstName;
                    result.LastName      = item.LastName;
                    result.Gender        = item.Gender;
                    result.StreetAddress = item.StreetAddress;
                    result.City          = item.City;
                    result.State         = item.State;
                    result.Country       = item.Country;
                    result.Institution   = item.Institution;
                    result.PhoneNumber   = item.PhoneNumber;

                    results.Add(result);
                }
            }
            return(View(results));
        }
Ejemplo n.º 3
0
        //
        // GET: /Login/
        public ActionResult Login()
        {
            //get user credential
            string currentUserEmail = HttpContext.User.Identity.Name;

            if (currentUserEmail != "")
            {
                Icasie.Repositories.User user = new Repositories.User();

                using (IcasieEntities entity = new IcasieEntities())
                {
                    user = entity.Users.SingleOrDefault(c => c.Email == currentUserEmail);
                }

                switch (user.Role)
                {
                case Constant.Role.Author:
                    return(RedirectToAction("Index", "Submission"));

                case Constant.Role.Participant:
                    return(RedirectToAction("Index", "Participant"));

                default:
                    return(RedirectToAction("Index", "Conference"));
                }
            }

            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult PaperList(int id)
        {
            List <ViewModelSubmission> results = new List <ViewModelSubmission>();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var submissions = entity.Submissions.Where(c => c.ConferenceId == id).OrderBy(c => c.FullPaperDate);
                foreach (var subItem in submissions)
                {
                    ViewModelSubmission newSubmission = new ViewModelSubmission();

                    var user = entity.Users.SingleOrDefault(c => c.UserId == subItem.UserId);

                    newSubmission.AuthorName      = user.FirstName + " " + user.LastName;
                    newSubmission.UserId          = subItem.UserId;
                    newSubmission.ConferenceId    = subItem.ConferenceId;
                    newSubmission.FullPaperStatus = subItem.FullPaperStatus;
                    newSubmission.FullPaperDate   = subItem.FullPaperDate;
                    newSubmission.PaymentDate     = subItem.PaymentDate;
                    newSubmission.Comment         = subItem.Comment;
                    newSubmission.Title           = subItem.Title;
                    newSubmission.SubmissionId    = subItem.SubmissionId;
                    newSubmission.Institution     = user.Institution;
                    newSubmission.Number          = subItem.PaperNumber;
                    results.Add(newSubmission);
                }
            }
            return(View(results));
        }
Ejemplo n.º 5
0
        public ActionResult ChangePassword(ViewModelChangePassword model)
        {
            string role = string.Empty;

            if (model.NewPassword != model.RetypePassword)
            {
                ModelState.AddModelError("PasswordDontMatch", "'ReType New Password' and 'New Password' do not match");
                return(View(model));
            }

            using (IcasieEntities entity = new IcasieEntities())
            {
                string currentUserEmail = HttpContext.User.Identity.Name;
                var    user             = entity.Users.SingleOrDefault(c => c.Email == currentUserEmail);
                string salt             = user.Salt;
                string password         = Icasie.Helper.Helper.CreatePasswordHash(model.NewPassword, salt);

                user.Password = password;

                role = user.Role;

                entity.SaveChanges();

                System.Threading.Tasks.Task.Run(() => EmailHelper.SendEmailPasswordChange(user.Email, user.FirstName + " " + user.LastName, model.NewPassword));
            }

            ViewData["message"] = " Your password succesfully changed";

            return(View());
        }
        public ActionResult Assign(int id)
        {
            //get user credential
            string currentUserEmail = HttpContext.User.Identity.Name;

            ViewModelConference newConf = new ViewModelConference();

            PrepareSelectList();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var subThemes = entity.SubThemes.ToList();

                var conference = entity.Conferences.SingleOrDefault(c => c.ConferenceId == id);

                //fill the properties
                newConf.ConferenceId      = conference.ConferenceId;
                newConf.Name              = conference.Name;
                newConf.StartDate         = conference.StartDate;
                newConf.EndDate           = conference.EndDate;
                newConf.PaperSubStartDate = conference.PaperSubStartDate;
                newConf.PaperSubEndDate   = conference.PaperSubEndDate;
                newConf.Submissions       = new List <ViewModelSubmission>();

                var uses = entity.Users.ToList();

                var submissions = entity.Submissions.Where(c => c.ConferenceId == conference.ConferenceId);
                foreach (var subItem in submissions)
                {
                    var user          = uses.SingleOrDefault(c => c.UserId == subItem.UserId);
                    var formatChecker = uses.SingleOrDefault(c => c.UserId == subItem.FormatCheckerId);
                    var reviwer       = uses.SingleOrDefault(c => c.UserId == subItem.ReviewedBy);
                    var proofReader   = uses.SingleOrDefault(c => c.UserId == subItem.ProofReaderId);

                    ViewModelSubmission newSubmission = new ViewModelSubmission();
                    newSubmission.UserId            = subItem.UserId;
                    newSubmission.AuthorName        = user.FirstName + " " + user.LastName;
                    newSubmission.ConferenceId      = subItem.ConferenceId;
                    newSubmission.FullPaperStatus   = subItem.FullPaperStatus;
                    newSubmission.Title             = subItem.Title;
                    newSubmission.SubmissionId      = subItem.SubmissionId;
                    newSubmission.Number            = subItem.PaperNumber;
                    newSubmission.SubThemesId       = subItem.SubThemesId;
                    newSubmission.SubThemes         = subThemes.FirstOrDefault(c => c.SubThemesId == subItem.SubThemesId).Title;
                    newSubmission.PaymentTypeString = subItem.PaymentType == Constant.PaymentType.Full ? Constant.PaymentType.FullString : Constant.PaymentType.PartialString;
                    newSubmission.PaymentType       = subItem.PaymentType;
                    newSubmission.FormatCheckerName = subItem.FormatCheckerId.HasValue ? formatChecker.FirstName + " " + formatChecker.LastName : "";
                    newSubmission.FormatCheckerId   = subItem.FormatCheckerId.HasValue ? subItem.FormatCheckerId.Value : 0;
                    newSubmission.ReviewerName      = subItem.ReviewedBy.HasValue ? reviwer.FirstName + " " + reviwer.LastName : "";
                    newSubmission.ReviewedBy        = subItem.ReviewedBy.HasValue ? subItem.ReviewedBy.Value : 0;
                    newSubmission.ProofReaderName   = subItem.ProofReaderId.HasValue ? proofReader.FirstName + " " + proofReader.LastName : "";
                    newSubmission.ProofReaderId     = subItem.ProofReaderId.HasValue ? subItem.ProofReaderId.Value : 0;


                    newConf.Submissions.Add(newSubmission);
                }
            }
            return(View(newConf));
        }
        private void PrepareSelectList()
        {
            List <SelectListItem> reviewerList = new List <SelectListItem>();


            using (IcasieEntities entity = new IcasieEntities())
            {
                var reviewers = entity.Users.Where(c => c.Role.Equals(Constant.Role.Reviewer)).ToList();

                foreach (var item in reviewers)
                {
                    reviewerList.Add(new SelectListItem {
                        Text = item.FirstName + " " + item.LastName, Value = item.UserId.ToString()
                    });
                }
            }


            ViewData["Reviewers"] = reviewerList;

            List <SelectListItem> proofReaderList = new List <SelectListItem>();


            using (IcasieEntities entity = new IcasieEntities())
            {
                var proofReaders = entity.Users.Where(c => c.Role.Equals(Constant.Role.ProofReader)).ToList();

                foreach (var item in proofReaders)
                {
                    proofReaderList.Add(new SelectListItem {
                        Text = item.FirstName + " " + item.LastName, Value = item.UserId.ToString()
                    });
                }
            }


            ViewData["ProofReaders"] = proofReaderList;

            List <SelectListItem> formatCheckerList = new List <SelectListItem>();


            using (IcasieEntities entity = new IcasieEntities())
            {
                var formatCheckers = entity.Users.Where(c => c.Role.Equals(Constant.Role.FormatChecker)).ToList();

                foreach (var item in formatCheckers)
                {
                    formatCheckerList.Add(new SelectListItem {
                        Text = item.FirstName + " " + item.LastName, Value = item.UserId.ToString()
                    });
                }
            }


            ViewData["FormatCheckers"] = formatCheckerList;
        }
Ejemplo n.º 8
0
        public ActionResult Register(int id, HttpPostedFileBase payment)
        {
            if (payment == null)
            {
                ModelState.AddModelError("payment", "Payment evidence cannot be empty");
            }

            if (!ModelState.IsValid)
            {
                ViewModelParticipant participant = new ViewModelParticipant();
                return(View(participant));
            }

            using (IcasieEntities entity = new IcasieEntities())
            {
                Participant part = new Participant();

                string currentUserEmail = HttpContext.User.Identity.Name;

                var user = entity.Users.SingleOrDefault(c => c.Email == currentUserEmail);

                part.UserId          = user.UserId;
                part.ConferenceId    = id;
                part.PaymentFileName = payment.FileName;
                part.PaymentDate     = DateTime.Now;
                part.PaymentStatus   = Constant.PaymentStatus.Submitted;
                var fees = entity.Fees.ToList();

                if (user.Country != Constant.Indonesia)
                {
                    part.TotalPayment = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.OverseasParticipant)).Price;
                }
                else
                {
                    part.TotalPayment = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.IndonesianParticipant)).Price;
                }

                using (Stream inputStream = payment.InputStream)
                {
                    MemoryStream memoryStream = inputStream as MemoryStream;
                    if (memoryStream == null)
                    {
                        memoryStream = new MemoryStream();
                        inputStream.CopyTo(memoryStream);
                    }
                    part.Payment = memoryStream.ToArray();
                }

                entity.Participants.Add(part);

                entity.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
        //
        // GET: /Administration/
        public ActionResult ParticipantPayment(int id)
        {
            //get user credential
            string currentUserEmail = HttpContext.User.Identity.Name;

            List <ViewModelConference> confList = new List <ViewModelConference>();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var conference = entity.Conferences.Where(c => c.ConferenceId == id).ToList();

                foreach (var item in conference)
                {
                    ViewModelConference newConf = new ViewModelConference();
                    newConf.PaperSubActive = false;

                    if (item.PaperSubStartDate <= DateTime.Now && item.PaperSubEndDate >= DateTime.Now)
                    {
                        newConf.PaperSubActive = true;
                    }

                    //fill the properties
                    newConf.ConferenceId      = item.ConferenceId;
                    newConf.Name              = item.Name;
                    newConf.StartDate         = item.StartDate;
                    newConf.EndDate           = item.EndDate;
                    newConf.PaperSubStartDate = item.PaperSubStartDate;
                    newConf.PaperSubEndDate   = item.PaperSubEndDate;
                    newConf.Participants      = new List <ViewModelParticipant>();

                    var participants = entity.Participants.Where(c => c.ConferenceId == item.ConferenceId);
                    foreach (var subItem in participants)
                    {
                        var user = entity.Users.FirstOrDefault(c => c.UserId == subItem.UserId);

                        ViewModelParticipant newParticipant = new ViewModelParticipant();
                        newParticipant.Name            = user.FirstName + " " + user.LastName;
                        newParticipant.UserId          = subItem.UserId;
                        newParticipant.ConferenceId    = subItem.ConferenceId;
                        newParticipant.ParticipantId   = subItem.ParticipantId;
                        newParticipant.Payment         = subItem.Payment;
                        newParticipant.PaymentDate     = subItem.PaymentDate.ToString(Icasie.Helper.Constant.DateFormat);
                        newParticipant.PaymentFileName = subItem.PaymentFileName;
                        newParticipant.PaymentStatus   = subItem.PaymentStatus;
                        newParticipant.Number          = subItem.Number;
                        newParticipant.TotalPayment    = subItem.TotalPayment;

                        newConf.Participants.Add(newParticipant);
                    }

                    confList.Add(newConf);
                }
            }
            return(View(confList));
        }
Ejemplo n.º 10
0
        public ActionResult Create(ViewModelConference model)
        {
            DateTime outStartDate      = new DateTime();
            DateTime outEndDate        = new DateTime();
            DateTime outPaperStartDate = new DateTime();
            DateTime outPaperEndDate   = new DateTime();

            IFormatProvider provider = CultureInfo.CurrentCulture;

            if (!DateTime.TryParseExact(model.StartDateString, Constant.DateFormatInput, provider, DateTimeStyles.None, out outStartDate))
            {
                ModelState.AddModelError("StartDateString", "Start Date format is not valid");
            }

            if (!DateTime.TryParseExact(model.EndDateString, Constant.DateFormatInput, provider, DateTimeStyles.None, out outEndDate))
            {
                ModelState.AddModelError("EndDateString", "End Date format is not valid");
            }

            if (!DateTime.TryParseExact(model.PaperSubStartDateString, Constant.DateFormatInput, provider, DateTimeStyles.None, out outPaperStartDate))
            {
                ModelState.AddModelError("PaperSubStartDateString", "Paper Submission Start Date format is not valid");
            }

            if (!DateTime.TryParseExact(model.PaperSubEndDateString, Constant.DateFormatInput, provider, DateTimeStyles.None, out outPaperEndDate))
            {
                ModelState.AddModelError("PaperSubEndDateString", "Paper Submission End Date format is not valid");
            }

            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            using (IcasieEntities entity = new IcasieEntities())
            {
                Conference conference = new Conference();

                var prefix = model.Name.Replace(" ", "");
                prefix = prefix.ToUpper();

                conference.Name                  = model.Name;
                conference.StartDate             = outStartDate;
                conference.EndDate               = outEndDate;
                conference.PaperSubStartDate     = outPaperStartDate;
                conference.PaperSubEndDate       = outPaperEndDate;
                conference.LastSequenceNumber    = prefix + "-" + Constant.NumberSuffix;
                conference.LastParticipantNumber = prefix + "-PART-" + Constant.NumberSuffix;

                entity.Conferences.Add(conference);
                entity.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 11
0
        private string GetLatestSequenceNumber(int conferenceId)
        {
            using (var db = new IcasieEntities())
            {
                var conference        = db.Conferences.SingleOrDefault(c => c.ConferenceId == conferenceId);
                var newSequenceNumber = NumberGenerator.NxtKeyCode(conference.LastSequenceNumber);
                conference.LastSequenceNumber = newSequenceNumber;
                db.SaveChanges();

                return(newSequenceNumber);
            }
        }
        public ActionResult VerifyPayment(int id, int conferenceId)
        {
            using (IcasieEntities entity = new IcasieEntities())
            {
                var submission = entity.Submissions.SingleOrDefault(c => c.SubmissionId == id);
                submission.FullPaperStatus         = Constant.FullPaperStatus.PaymentVerified;
                submission.PaymentVerificationDate = DateTime.Now;
                entity.SaveChanges();
            }

            return(RedirectToAction("AuthorPayment", new { id = conferenceId }));
        }
Ejemplo n.º 13
0
        public ActionResult Edit(int id)
        {
            ViewModelSubmission sub = new ViewModelSubmission();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var oldSub = entity.Submissions.SingleOrDefault(c => c.SubmissionId == id);
                sub.SubmissionId = oldSub.SubmissionId;
                sub.ConferenceId = oldSub.ConferenceId;
                sub.Title        = oldSub.Title;
            }
            return(View(sub));
        }
        public ActionResult AuthorPayment(int id)
        {
            //get user credential
            string currentUserEmail = HttpContext.User.Identity.Name;

            ViewModelConference newConf = new ViewModelConference();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var subThemes = entity.SubThemes.ToList();

                var conference = entity.Conferences.SingleOrDefault(c => c.ConferenceId == id);

                //fill the properties
                newConf.ConferenceId      = conference.ConferenceId;
                newConf.Name              = conference.Name;
                newConf.StartDate         = conference.StartDate;
                newConf.EndDate           = conference.EndDate;
                newConf.PaperSubStartDate = conference.PaperSubStartDate;
                newConf.PaperSubEndDate   = conference.PaperSubEndDate;
                newConf.Submissions       = new List <ViewModelSubmission>();

                var uses = entity.Users.ToList();

                var submissions = entity.Submissions.Where(c => c.ConferenceId == conference.ConferenceId && (c.FullPaperStatus == Constant.FullPaperStatus.Pending || c.FullPaperStatus == Constant.FullPaperStatus.PaymentVerified));
                foreach (var subItem in submissions)
                {
                    var user = uses.SingleOrDefault(c => c.UserId == subItem.UserId);

                    ViewModelSubmission newSubmission = new ViewModelSubmission();
                    newSubmission.UserId = subItem.UserId;
                    newSubmission.PaymentVerificationDate = subItem.PaymentVerificationDate.HasValue ? subItem.PaymentVerificationDate.Value : newSubmission.PaymentVerificationDate;
                    newSubmission.AuthorName        = user.FirstName + " " + user.LastName;
                    newSubmission.ConferenceId      = subItem.ConferenceId;
                    newSubmission.FullPaperStatus   = subItem.FullPaperStatus;
                    newSubmission.Title             = subItem.Title;
                    newSubmission.SubmissionId      = subItem.SubmissionId;
                    newSubmission.Number            = subItem.PaperNumber;
                    newSubmission.SubThemesId       = subItem.SubThemesId;
                    newSubmission.TotalPayment      = subItem.TotalPayment.Value;
                    newSubmission.SubThemes         = subThemes.FirstOrDefault(c => c.SubThemesId == subItem.SubThemesId).Title;
                    newSubmission.PaymentTypeString = subItem.PaymentType == Constant.PaymentType.Full ? Constant.PaymentType.FullString : Constant.PaymentType.PartialString;

                    newSubmission.PaymentDate = subItem.PaymentDate;


                    newConf.Submissions.Add(newSubmission);
                }
            }
            return(View(newConf));
        }
Ejemplo n.º 15
0
        public ActionResult EditProofReading(int id, HttpPostedFileBase file)
        {
            if (file == null)
            {
                ModelState.AddModelError("file", "File cannot be empty");

                ViewModelSubmission sub = new ViewModelSubmission();
                using (IcasieEntities entity = new IcasieEntities())
                {
                    var oldSub = entity.Submissions.SingleOrDefault(c => c.SubmissionId == id);
                    sub.SubmissionId = oldSub.SubmissionId;
                    sub.Title        = oldSub.Title;
                    sub.SubThemesId  = oldSub.SubThemesId;
                }

                PrepareSelectList();

                return(View(sub));
            }

            using (IcasieEntities entity = new IcasieEntities())
            {
                var sub = entity.Submissions.SingleOrDefault(c => c.SubmissionId == id);
                sub.FullPaperStatus            = Constant.FullPaperStatus.Reviewed;
                sub.ProofReadingDate           = null;
                sub.ProofReadingResultFileName = null;
                sub.ProofReadingResult         = null;
                sub.Comment = Constant.InitialCommentProofRead;

                if (file != null)
                {
                    using (Stream inputStream = file.InputStream)
                    {
                        MemoryStream memoryStream = inputStream as MemoryStream;
                        if (memoryStream == null)
                        {
                            memoryStream = new MemoryStream();
                            inputStream.CopyTo(memoryStream);
                        }
                        sub.FullPaper         = memoryStream.ToArray();
                        sub.FullPaperFileName = file.FileName;
                    }
                }


                entity.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 16
0
        public ActionResult EditProofReading(int id)
        {
            ViewModelSubmission sub = new ViewModelSubmission();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var oldSub = entity.Submissions.SingleOrDefault(c => c.SubmissionId == id);
                sub.SubmissionId = oldSub.SubmissionId;
                sub.Title        = oldSub.Title;
                sub.SubThemesId  = oldSub.SubThemesId;
            }
            PrepareSelectList();
            return(View(sub));
        }
Ejemplo n.º 17
0
        public ActionResult Edit(ViewModelConference model)
        {
            DateTime outStartDate      = new DateTime();
            DateTime outEndDate        = new DateTime();
            DateTime outPaperStartDate = new DateTime();
            DateTime outPaperEndDate   = new DateTime();

            IFormatProvider provider = CultureInfo.CurrentCulture;

            if (!DateTime.TryParseExact(model.StartDateString, Constant.DateFormatInput, provider, DateTimeStyles.None, out outStartDate))
            {
                ModelState.AddModelError("StartDateString", "Start Date format is not valid");
            }

            if (!DateTime.TryParseExact(model.EndDateString, Constant.DateFormatInput, provider, DateTimeStyles.None, out outEndDate))
            {
                ModelState.AddModelError("EndDateString", "End Date format is not valid");
            }

            if (!DateTime.TryParseExact(model.PaperSubStartDateString, Constant.DateFormatInput, provider, DateTimeStyles.None, out outPaperStartDate))
            {
                ModelState.AddModelError("PaperSubStartDateString", "Paper Submission Start Date format is not valid");
            }

            if (!DateTime.TryParseExact(model.PaperSubEndDateString, Constant.DateFormatInput, provider, DateTimeStyles.None, out outPaperEndDate))
            {
                ModelState.AddModelError("PaperSubEndDateString", "Paper Submission End Date format is not valid");
            }

            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            using (IcasieEntities entity = new IcasieEntities())
            {
                var odlConf = entity.Conferences.SingleOrDefault(c => c.ConferenceId == model.ConferenceId);

                odlConf.Name              = model.Name;
                odlConf.StartDate         = outStartDate;
                odlConf.EndDate           = outEndDate;
                odlConf.PaperSubStartDate = outPaperStartDate;
                odlConf.PaperSubEndDate   = outPaperEndDate;

                entity.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 18
0
        public ActionResult AddFullPaper(int id)
        {
            ViewData["ConferenceId"] = id;

            string currentUserEmail = HttpContext.User.Identity.Name;

            using (IcasieEntities entity = new IcasieEntities())
            {
                PrepareViewData(entity);
            }

            PrepareSelectList();

            return(View());
        }
Ejemplo n.º 19
0
        public ActionResult Login(ViewModelLogin login, bool captchaValid)
        {
            if (!ModelState.IsValid)
            {
                return(View(login));
            }

            Icasie.Repositories.User user = new Repositories.User();

            using (IcasieEntities entity = new IcasieEntities())
            {
                user = entity.Users.SingleOrDefault(c => c.Email == login.Email);
            }

            if (user != null && Helper.Helper.CreatePasswordHash(login.Password, user.Salt) == user.Password)
            {
                int timeout = Constant.CookieExpiration.Normal;
                var ticket  = new FormsAuthenticationTicket(1, user.Email, DateTime.Now, DateTime.Now.AddMinutes(timeout), true, user.Role);
                var cookie  = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));

                if (ticket.IsPersistent)
                {
                    cookie.Expires = ticket.Expiration;
                }

                Response.Cookies.Add(cookie);
            }
            else
            {
                TempData["Message"] = "User & Password combination cannot be found";

                return(View(login));
            }

            switch (user.Role)
            {
            case Constant.Role.Author:
                return(RedirectToAction("Index", "Submission"));

            case Constant.Role.Participant:
                return(RedirectToAction("Index", "Participant"));

            default:
                return(RedirectToAction("Index", "Conference"));
            }
        }
Ejemplo n.º 20
0
        public ActionResult Edit(int id)
        {
            ViewModelConference result = new ViewModelConference();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var conf = entity.Conferences.SingleOrDefault(c => c.ConferenceId == id);
                result.Name                    = conf.Name;
                result.ConferenceId            = conf.ConferenceId;
                result.StartDateString         = conf.StartDate.ToString(Constant.DateFormatInput);
                result.EndDateString           = conf.EndDate.ToString(Constant.DateFormatInput);
                result.PaperSubStartDateString = conf.PaperSubStartDate.ToString(Constant.DateFormatInput);
                result.PaperSubEndDateString   = conf.PaperSubEndDate.ToString(Constant.DateFormatInput);
            }

            return(View(result));
        }
Ejemplo n.º 21
0
        public ActionResult Register(ViewModelUser model, bool captchaValid)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            string randomPassword = Icasie.Helper.Helper.GenerateRandomGuidPassword().Substring(0, 10);

            var    random   = new Random();
            string salt     = Icasie.Helper.Helper.CreateSalt(random.Next(10, 100));
            string password = Icasie.Helper.Helper.CreatePasswordHash(randomPassword, salt);

            using (IcasieEntities entity = new IcasieEntities())
            {
                if (entity.Users.Any(c => c.Email == model.Email))
                {
                    ViewData["message"] = "User already exist";
                    return(View(model));
                }
                Icasie.Repositories.User user = new Icasie.Repositories.User();
                user.Email         = model.Email;
                user.City          = model.City;
                user.Country       = model.Country;
                user.FirstName     = model.FirstName;
                user.LastName      = model.LastName;
                user.Password      = password;
                user.PhoneNumber   = model.PhoneNumber;
                user.Role          = model.Role;
                user.Salt          = salt;
                user.State         = model.State;
                user.StreetAddress = model.StreetAddress;
                user.Gender        = model.Gender;
                user.Institution   = model.Institution;

                entity.Users.Add(user);
                entity.SaveChanges();

                System.Threading.Tasks.Task.Run(() => EmailHelper.SendEmailNewUser(model.Email, model.FirstName + " " + model.LastName, randomPassword, ConfigurationManager.AppSettings["SiteName"]));
            }

            return(View("RegisterSuccess"));
        }
        public ActionResult VerifyPaymentParticipant(int id, string status, int conferenceId)
        {
            using (IcasieEntities entity = new IcasieEntities())
            {
                var payment = entity.Participants.SingleOrDefault(c => c.ParticipantId == id);
                if (status == Constant.PaymentStatus.Accepted)
                {
                    payment.Number        = GetLatestSequenceNumber(conferenceId);
                    payment.PaymentStatus = Constant.PaymentStatus.Accepted;
                }
                else
                {
                    payment.PaymentStatus = Constant.PaymentStatus.Rejected;
                }

                entity.SaveChanges();
            }

            return(RedirectToAction("ParticipantPayment", new { id = conferenceId }));
        }
Ejemplo n.º 23
0
        public ActionResult EditFullPaper(int id)
        {
            ViewModelSubmission sub = new ViewModelSubmission();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var oldSub = entity.Submissions.SingleOrDefault(c => c.SubmissionId == id);
                sub.SubmissionId    = oldSub.SubmissionId;
                sub.Title           = oldSub.Title;
                sub.SubThemesId     = oldSub.SubThemesId;
                sub.CoAuthors       = oldSub.CoAuthors;
                sub.PaymentType     = oldSub.PaymentType;
                sub.FullPaperStatus = oldSub.FullPaperStatus;

                PrepareViewData(entity);
            }

            PrepareSelectList();

            return(View(sub));
        }
Ejemplo n.º 24
0
        private void PrepareViewData(IcasieEntities entity)
        {
            string currentUserEmail = HttpContext.User.Identity.Name;

            var user = entity.Users.SingleOrDefault(c => c.Email.Equals(currentUserEmail));
            var fees = entity.Fees.ToList();

            if (user.Country != Constant.Indonesia)
            {
                ViewData["Full"]         = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.OverseasFull)).Price;
                ViewData["Seminar"]      = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.OverseasSeminar)).Price;
                ViewData["Coauthor"]     = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.OverseasCoauthor)).Price;
                ViewData["IsIndonesian"] = "true";
            }
            else
            {
                ViewData["Full"]         = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.IndonesianFull)).Price;
                ViewData["Seminar"]      = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.IndonesianSeminar)).Price;
                ViewData["Coauthor"]     = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.IndonesianCoauthor)).Price;
                ViewData["IsIndonesian"] = "false";
            }
        }
Ejemplo n.º 25
0
        public ActionResult PaperList(int id)
        {
            List <ViewModelSubmission> results = new List <ViewModelSubmission>();

            using (IcasieEntities entity = new IcasieEntities())
            {
                var conference = entity.Conferences.SingleOrDefault(c => c.ConferenceId == id);
                ViewData["ConferenceName"] = conference.Name;

                var submissions = entity.Submissions.Where(c => c.ConferenceId == id).OrderBy(c => c.FullPaperDate);
                foreach (var subItem in submissions)
                {
                    ViewModelSubmission newSubmission = new ViewModelSubmission();

                    var user          = entity.Users.SingleOrDefault(c => c.UserId == subItem.UserId);
                    var formatChecker = entity.Users.SingleOrDefault(c => c.UserId == subItem.FormatCheckerId);
                    var reviewer      = entity.Users.SingleOrDefault(c => c.UserId == subItem.ReviewedBy);
                    var proofReader   = entity.Users.SingleOrDefault(c => c.UserId == subItem.ProofReaderId);

                    newSubmission.AuthorName        = user.FirstName + " " + user.LastName;
                    newSubmission.UserId            = subItem.UserId;
                    newSubmission.ConferenceId      = subItem.ConferenceId;
                    newSubmission.FullPaperStatus   = subItem.FullPaperStatus;
                    newSubmission.FullPaperDate     = subItem.FullPaperDate;
                    newSubmission.PaymentDate       = subItem.PaymentDate;
                    newSubmission.Comment           = subItem.Comment;
                    newSubmission.Title             = subItem.Title;
                    newSubmission.SubmissionId      = subItem.SubmissionId;
                    newSubmission.Institution       = user.Institution;
                    newSubmission.Number            = subItem.PaperNumber;
                    newSubmission.FormatCheckerName = reviewer != null ? formatChecker.FirstName + " " + formatChecker.LastName : "";
                    newSubmission.ReviewerName      = reviewer != null ? reviewer.FirstName + " " + reviewer.LastName : "";
                    newSubmission.ProofReaderName   = proofReader != null ? proofReader.FirstName + " " + proofReader.LastName : "";
                    results.Add(newSubmission);
                }
            }
            return(View(results));
        }
        public ActionResult Assign(int reviewer, int submission, int proofReader, int formatChecker)
        {
            string        conferenceName     = string.Empty;
            string        title              = string.Empty;
            List <string> formatCheckerEmail = new List <string>();

            using (var db = new IcasieEntities())
            {
                var sub = db.Submissions.SingleOrDefault(c => c.SubmissionId == submission);
                conferenceName      = db.Conferences.SingleOrDefault(c => c.ConferenceId == sub.ConferenceId).Name;
                title               = sub.Title;
                sub.ReviewedBy      = reviewer;
                sub.ProofReaderId   = proofReader;
                sub.FormatCheckerId = formatChecker;
                db.SaveChanges();

                formatCheckerEmail.Add(db.Users.SingleOrDefault(c => c.UserId == formatChecker).Email);
            }

            Task.Run(() => Helper.EmailHelper.SendEmailNotification(formatCheckerEmail, Constant.NotificationMode.AssignReviewer, conferenceName, title));

            return(RedirectToAction("Assign"));
        }
Ejemplo n.º 27
0
        private void PrepareSelectList()
        {
            List <SelectListItem> subThemeList = new List <SelectListItem>();

            subThemeList.Add(new SelectListItem {
                Text = "Choose Sub Theme", Value = ""
            });

            using (IcasieEntities entity = new IcasieEntities())
            {
                var subThemes = entity.SubThemes.ToList();

                foreach (var item in subThemes)
                {
                    subThemeList.Add(new SelectListItem {
                        Text = item.Title, Value = item.SubThemesId.ToString()
                    });
                }
            }


            ViewData["SubThemesId"] = subThemeList;
        }
Ejemplo n.º 28
0
        public ActionResult Register(int id)
        {
            string currentUserEmail = HttpContext.User.Identity.Name;

            using (IcasieEntities entity = new IcasieEntities())
            {
                var user = entity.Users.SingleOrDefault(c => c.Email.Equals(currentUserEmail));
                var fees = entity.Fees.ToList();

                if (user.Country != Constant.Indonesia)
                {
                    ViewData["Fee"] = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.OverseasParticipant)).Price;
                }
                else
                {
                    ViewData["Fee"] = fees.SingleOrDefault(c => c.Name.Equals(Constant.Fees.IndonesianParticipant)).Price;
                }
            }

            ViewData["ConferenceId"] = id;

            return(View());
        }
Ejemplo n.º 29
0
        public ActionResult Delete(int id)
        {
            bool isExist = false;

            using (IcasieEntities entity = new IcasieEntities())
            {
                isExist = entity.Submissions.Any(c => c.ConferenceId == id);
                if (isExist == false)
                {
                    var conference = entity.Conferences.SingleOrDefault(c => c.ConferenceId == id);

                    entity.Conferences.Remove(conference);
                    entity.SaveChanges();
                }
            }

            if (isExist == true)
            {
                TempData["Message"] = "Conference cannot be deleted";
            }

            return(RedirectToAction("index"));
        }
Ejemplo n.º 30
0
        public ActionResult SubmitPayment(int id, HttpPostedFileBase payment)
        {
            if (payment == null)
            {
                ModelState.AddModelError("payment", "Payment evidence cannot be empty");
            }

            if (!ModelState.IsValid)
            {
                ViewModelSubmission sub = new ViewModelSubmission();
                sub.SubmissionId = id;
                return(View(sub));
            }

            using (IcasieEntities entity = new IcasieEntities())
            {
                var sub = entity.Submissions.SingleOrDefault(c => c.SubmissionId == id);
                sub.PaymentFileName = payment.FileName;
                sub.FullPaperDate   = DateTime.Now;
                sub.PaymentDate     = DateTime.Now;

                using (Stream inputStream = payment.InputStream)
                {
                    MemoryStream memoryStream = inputStream as MemoryStream;
                    if (memoryStream == null)
                    {
                        memoryStream = new MemoryStream();
                        inputStream.CopyTo(memoryStream);
                    }
                    sub.Payment = memoryStream.ToArray();
                }

                entity.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }