示例#1
0
        public ActionResult Upload(HttpPostedFileBase file)
        {
            ProposalModel proposal = (ProposalModel)Session["Proposal"];

            if (file == null)
            {
                ViewBag.Error = "No selecciono un archivo";
                return(View("RegisterUserProposal", null));
            }

            string archivo = (DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + file.FileName).ToLower();
            string ruta    = Server.MapPath("~/Files/" + archivo);

            file.SaveAs(Server.MapPath("~/Files/" + archivo));
            if (RegistroMasivo(ruta, ((ProposalModel)Session["Proposal"]).ContracEthereumProposal, ((ProposalModel)Session["Proposal"]).ProposalName))
            {
                ViewBag.Success = "Se enviaron las invitaciones con éxito.";
                ProposalBussiness ProposalLogic = new ProposalBussiness();

                ProposalFilter Filtro = new ProposalFilter();
                UserModel      user   = (UserModel)Session["User"];
                Filtro.Email        = user.Email;
                Filtro.QuestionType = null;
                List <ProposalModel> ListProposal = new List <ProposalModel>();

                ListProposal = ProposalLogic.SearchProposalByUser(Filtro);
                return(View("ProposalList", ListProposal));
            }
            else
            {
                ViewBag.Error = "Hay Correos Invalidos";
                return(View("RegisterUserProposal", null));
            }
            //  return View("ProposalList");
        }
示例#2
0
        //public ActionResult RegistrarOption(UserModel Data)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        ProposalBussiness ProposalLogic = new ProposalBussiness();
        //        ProposalLogi.


        //        bool existUser = false;
        //                bool valid = false;
        //                valid = RegisterUser(Data, out existUser);
        //                if (existUser)
        //                {
        //                    //si es true el usuario existe mesaje de que existe en la vista
        //                    ViewBag.ErrorUsuarioExiste = "El usuario " + Data.UserName + " ya fue registrado anteriormente";

        //                }
        //                else
        //                {
        //                    if (valid)
        //                    {
        //                        return RedirectToAction("UserList", "User");
        //                    }
        //                    else
        //                    {

        //                        ViewBag.ErrorDesconocido = "Occurió un error insertando. Por favor intentelo nuevamente.";
        //                    }
        //                }


        //    }
        //    else
        //    {
        //        return View("NewUser", Data);
        //    }
        //    return View("NewUser", Data);
        //}

        public ActionResult NewOption(string p, string n)
        {
            try
            {
                UserModel user = (UserModel)Session["User"];
                if (user == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ProposalFilter Filtro = new ProposalFilter();
                    Filtro.Email = user.Email;
                    //   Filtro.TypeVoting = 0;

                    ProposalBussiness ProposalLogic = new ProposalBussiness();

                    List <ProposalModel> ListProposal = new List <ProposalModel>();


                    NewOptionModel NewOption = new NewOptionModel();

                    NewOption.ProposalId   = p;
                    NewOption.ProposalName = n;
                    NewOption.Proposals    = ProposalLogic.SearchProposalByUser(Filtro);

                    return(View(NewOption));
                }
            }
            catch
            {
                return(View("Error"));
            }
        }
示例#3
0
        // GET: Votes
        public ActionResult Index(string id)
        {
            Session["propId"] = id;

            UserModel user = (UserModel)Session["User"];

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ProposalFilter Filtro = new ProposalFilter();
                Filtro.Email = user.Email;
                //  Filtro.TypeVoting = 0;

                ProposalBussiness ProposalLogic = new ProposalBussiness();

                List <ProposalModel> ListProposal = new List <ProposalModel>();

                ListProposal = ProposalLogic.SearchProposalByUser(Filtro);

                ProposalModel currentProposal = ListProposal.Where(x => x.ContracEthereumProposal == id).FirstOrDefault();

                ViewBag.UserEmail = user.Email;
                return(View(currentProposal));
            }
        }
示例#4
0
        public ActionResult EditSummit(ProposalModel proposal)
        {
            try
            {
                proposal.ContracEthereumProposal = ((ProposalModel)Session["Proposal"]).ContracEthereumProposal;
                proposal.QuestionType            = ((ProposalModel)Session["Proposal"]).QuestionType;
                UserModel user = (UserModel)Session["User"];

                using (ProposalDataAccess proposalDataAccess = new ProposalDataAccess())
                {
                    if (proposalDataAccess.UpdateProposal(proposal))
                    {
                        ProposalFilter Filtro = new ProposalFilter();
                        Filtro.Email = user.Email;
                        //  Filtro.TypeVoting = 0;

                        ProposalBussiness ProposalLogic = new ProposalBussiness();

                        List <ProposalModel> ListProposal = new List <ProposalModel>();

                        ListProposal = ProposalLogic.SearchProposalByUser(Filtro);

                        ViewBag.Success = "Se modificó correctamente";
                        return(View("ProposalList", ListProposal));
                    }
                    else
                    {
                        ProposalBussiness ProposalLogic = new ProposalBussiness();

                        ProposalModel Filtro = new ProposalModel();
                        Filtro.ContracEthereumProposal = proposal.ContracEthereumProposal;

                        ProposalModel CurrentProposal = new ProposalModel();

                        CurrentProposal      = ProposalLogic.SearchProposal(Filtro)[0];
                        ViewBag.SucceErrorss = "Se modificó correctamente";
                        return(View("Edit", CurrentProposal));
                    }
                }
            }
            catch
            {
                return(View("error"));
            }
        }
示例#5
0
        public ActionResult ProposalList()
        {
            UserModel user = (UserModel)Session["User"];

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ProposalFilter Filtro = new ProposalFilter();
                Filtro.Email = user.Email;
                ///  Filtro.QuestionType = EnumQuestionType.Papeleta;

                ProposalBussiness ProposalLogic = new ProposalBussiness();

                List <ProposalModel> ListProposal = new List <ProposalModel>();

                ListProposal = ProposalLogic.SearchProposalByUser(Filtro);

                return(View(ListProposal));
            }
        }
示例#6
0
        public List <ProposalModel> SearchProposalByUser(ProposalFilter filter)
        {
            ProposalBussiness bussiness = new ProposalBussiness();

            return(bussiness.SearchProposalByUser(filter));
        }