Beispiel #1
0
        public ActionResult CheckUniqueEmail(string email, string userId)
        {
            if (!String.IsNullOrEmpty(userId))
            {
                List <Registration> regList = null;
                if (!Validate.IsRegFormOpenForm(userId))
                {
                    userId = GeneralHelper.Base64Decode(userId);
                    Guid id = Guid.Empty;
                    Guid.TryParse(userId, out id);
                    regList = unitOfWork.RegistrationRepository.Get(filter: x => x.Email == email && x.Id != id).ToList();
                    if (regList.Count > 0)
                    {
                        return(Json(new { success = false }));
                    }
                }
                else
                {
                    regList = unitOfWork.RegistrationRepository.Get(filter: x => x.Email == email).ToList();
                    if (regList.Count > 0)
                    {
                        return(Json(new { success = false }));
                    }
                }
            }
            else
            {
                return(Json(new { success = false }));
            }

            return(Json(new { success = true }));
        }
Beispiel #2
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 #3
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 #4
0
        public ActionResult TrackEmail(string id)
        {
            Guid _id = Guid.Empty;

            if (String.IsNullOrEmpty(id))
            {
                Response.StatusCode = 409;
            }
            else
            {
                try
                {
                    id = GeneralHelper.Base64Decode(id);
                    Guid.TryParse(id, out _id);
                }
                catch
                {
                    Response.StatusCode = 409;
                }
            }

            var reg     = unitOfWork.RegistrationRepository.GetByID(_id);
            var setting = GeneralHelper.GetSetting(unitOfWork);

            if (reg.StepsAction == RegStepAction.INVT.ToString() || reg.StepsAction == RegStepAction.DFT.ToString())
            {
                reg.StepsAction = RegStepAction.READ.ToString(); //Email read
            }
            unitOfWork.RegistrationRepository.Update(reg);
            unitOfWork.Save();

            var weblocation = setting.WebLocation + "Images\\";
            var path        = Path.Combine(weblocation, "dot.jpg"); //validate the path for security or use other means to generate the path.

            return(base.File(path, "image/jpeg"));
        }