Beispiel #1
0
        public ActionResult Register(string id)
        {
            RegistrationViewModel model = new RegistrationViewModel();

            if (!String.IsNullOrEmpty(id))
            {
                if (Validate.IsRegFormOpenForm(id))
                {
                    model.IdStringEncypted = id; //store open form key as temporary on IdStringEncypted
                }
                else
                {
                    Guid _id = Guid.Empty;
                    try
                    {
                        id = GeneralHelper.Base64Decode(id);
                        Guid.TryParse(id, out _id);
                    }
                    catch
                    {
                        return(RedirectToAction("Index", "Error"));
                    }

                    var reg = unitOfWork.RegistrationRepository.GetByID(_id);

                    if (reg.Status == RegStatus.OK.ToString() && !Security.IsAdminLogin())
                    {
                        return(RedirectToAction("ThankYou"));
                    }
                    if (reg.StepsAction == RegStepAction.READ.ToString())
                    {
                        reg.StepsAction = RegStepAction.CLICK.ToString(); // link is clicked
                    }
                    unitOfWork.RegistrationRepository.Update(reg);
                    unitOfWork.Save();

                    model.Id = reg.Id;
                    model.IdStringEncypted = GeneralHelper.Base64Encode(reg.Id.ToString());
                    model.Name             = reg.Name;
                    //model.IDType = reg.IDType;
                    //model.IDNumber = reg.IDNumber;
                    model.Mobile       = reg.Mobile;
                    model.Email        = reg.Email;
                    model.Organisation = reg.Organisation;
                    model.Designation  = reg.Designation;
                    model.Image        = reg.Image;
                }
            }
            else
            {
                return(RedirectToAction("Index", "Error"));
            }

            return(View(model));
        }
Beispiel #2
0
        // GET: Home
        public ActionResult Index(string id)
        {
            Guid _id = Guid.Empty;

            if (String.IsNullOrEmpty(id))
            {
                return(RedirectToAction("Index", "Error"));
            }
            else
            {
                if (Validate.IsRegFormOpenForm(id))
                {
                    RegistrationViewModel openFormModel = new RegistrationViewModel();
                    openFormModel.IdStringEncypted = id; //store open form key as temporary on IdStringEncypted
                    return(View(openFormModel));
                }
                else
                {
                    try
                    {
                        id = GeneralHelper.Base64Decode(id);
                        Guid.TryParse(id, out _id);
                    }
                    catch
                    {
                        return(RedirectToAction("Index", "Error"));
                    }
                }
            }

            var reg = unitOfWork.RegistrationRepository.GetByID(_id);

            if (reg.Status == RegStatus.OK.ToString())
            {
                return(RedirectToAction("ThankYou", "Registration"));
            }
            RegistrationViewModel model = new RegistrationViewModel();

            model.Id = reg.Id;
            model.IdStringEncypted = GeneralHelper.Base64Encode(id.ToString());

            return(View(model));
        }
Beispiel #3
0
        private IEnumerable <RegistrationViewModel> GetRegistrationList(string filterBy)
        {
            List <Registration> regList = unitOfWork.RegistrationRepository.Get().ToList();

            if (!String.IsNullOrEmpty(filterBy))
            {
                string[] filterArray = filterBy.Split(',');

                foreach (string filterKey in filterArray)
                {
                    if (!String.IsNullOrEmpty(filterKey))
                    {
                        if (filterKey == "INVT" || filterKey == "READ" || filterKey == "CLICK" || filterKey == "CPLT")
                        {
                            regList = regList.Where(x => x.StepsAction == filterKey).ToList();
                        }
                        if (filterKey == "AllRegistered")
                        {
                            regList = regList.Where(x => x.Status == "OK" || x.Status == "DFT").ToList();
                        }
                        if (filterKey == "OK")
                        {
                            regList = regList.Where(x => x.Status == filterKey).ToList();
                        }
                        if (filterKey == "DFT")
                        {
                            regList = regList.Where(x => x.Status == filterKey).ToList();
                        }
                        if (filterKey == "AllGeneric")
                        {
                            regList = regList.Where(x => x.IsOpenForm == true || x.IsOpenForm == false).ToList();
                        }
                        if (filterKey == "True" || filterKey == "False")
                        {
                            bool isOpenForm = false;
                            Boolean.TryParse(filterKey, out isOpenForm);
                            regList = regList.Where(x => x.IsOpenForm == isOpenForm).ToList();
                        }
                    }
                }
            }


            string loginId = Security.GetCurrentUser();
            var    user    = unitOfWork.AdministratorRepository.Get(filter: x => x.LoginId == loginId).Single();

            return(regList.Select(reg => new RegistrationViewModel
            {
                IdStringEncypted = GeneralHelper.Base64Encode(reg.Id.ToString()),
                Id = reg.Id,
                SerialNo = reg.SerialNo,
                Name = reg.Name,
                Designation = reg.Designation,
                //IDType = GeneralHelper.GetIdTypeName(reg.IDType),
                //IDNumber = reg.IDNumber,
                Mobile = reg.Mobile,
                Email = reg.Email,
                Organisation = reg.Organisation,
                StepAction = GeneralHelper.GetRegStepStatus(reg.StepsAction),
                OpenForm = reg.IsOpenForm == true ? "Yes" : "No",
                DateSubmited = reg.DateSubmited,
                AdminRole = user.Role
            }));
        }