예제 #1
2
 private static void InitializeAcres()
 {
     Dictionary<string, double> acreGroups = new Dictionary<string, double>()
     {
         { "Less than .25", 0.0D },
         { ".25", 0.25D },
         { ".25+", 0.26D },
         { ".33", 0.33D },
         { ".33+", 0.34D },
         { ".5", 0.5D },
         { ".5+", 0.51D },
         { ".75", 0.75D },
         { ".75+", 0.76D },
         { "1", 1.0D },
         { "1+", 1.1D },
         { "1.25", 1.25D },
         { "1.25+", 1.26D },
         { "1.33", 1.33D },
         { "1.33+", 1.34D },
         { "1.5", 1.5D },
         { "1.5+", 1.51D },
         { "2", 2.0D },
         { "2+", 2.1D },
         { "3", 3.0D },
         { "3+", 3.1D },
         { "5", 5.0D },
         { "5+", 5.1D },
         { "10", 10.0D },
         { "10+", 10.1D }
     };
     SelectList final = new SelectList(acreGroups, "Value", "Key");
     acres = final;
 }
        // GET: /QuizGroup/Create
        public ActionResult Create()
        {
            var x = new SelectList(Enum.GetValues(typeof(GroupType)));
            ViewBag.GroupTypes = x;

            return View();
        }
예제 #3
0
        public ActionResult Create(tbl_User myUser)
        {
            ViewData["Roles"] = new SelectList(roledb.GetUserRoles(), "User_Role", "User_Role_Descr");

            if (myUser.User_CAI.Trim().Length == 0)
                ModelState.AddModelError("User_CAI", "CAI is Required");

            if (myUser.User_FirstName.Trim().Length == 0)
                ModelState.AddModelError("User_FirstName", "First Name Required");

            if (myUser.User_LastName.Trim().Length == 0)
                ModelState.AddModelError("User_LastName", "Last Name Required");

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

            try
            {
                myUser.User_CAI = myUser.User_CAI.ToUpper().Trim();
                db.AddUser(myUser);
                db.Save();
                return RedirectToAction("Details", new { User_CAI = myUser.User_CAI, Error = "" });

            }
            catch(Exception ex)
            {
                ModelState.AddModelError("","Error: " + ex.Message);
                return View();
            }
        }
        public ActionResult GetUsuarioByTipoId(int tipoid)
        {
            usuarioModel modeloUsuario = new usuarioModel();
            if (tipoid == 1)
            {
                //modeloUsuario.listaUsuarios = negAdministrador.Instancia.ListarAdministradoresPorTipo();
            }
            else if (tipoid == 2)
            {
                List<entUsuarioComun> objUsuarios = new List<entUsuarioComun>();
                objUsuarios = negMedico.Instancia.ListarMedicosPorIdTipo(2);
                SelectList obgUsuarios = new SelectList(objUsuarios, "idUsuario", "nombre");

                return Json(obgUsuarios);
            }
            else if (tipoid == 3)
            {

            }
            else if (tipoid == 4)
            {
                List<entUsuarioComun> objUsuarios = new List<entUsuarioComun>();
                objUsuarios = negPaciente.Instancia.ListarPacientesPorIdTipo(4);
                SelectList obgUsuarios = new SelectList(objUsuarios, "idUsuario", "nombre");

                return Json(obgUsuarios);
            }

            return View();
        }
예제 #5
0
        public ActionResult Create(tbl_Project myProject)
        {
            ViewData["Status"] = new SelectList(statusdb.GetStatus(), "Status_ID", "Status");
            if (!myProject.Project_Number.HasValue)
                ModelState.AddModelError("Project_Number", "Project Number is Required");
            if (myProject.SAP_Number.Trim().Length == 0)
                ModelState.AddModelError("SAP_Number", "SAP Number is Required");
            if (myProject.WBS.Trim().Length == 0)
                ModelState.AddModelError("WBS", "WBS is Required");
            if (myProject.Project_Name.Trim().Length == 0)
                ModelState.AddModelError("Project_Name", "Project Name is Required");
            if (!myProject.Status_ID.HasValue)
                ModelState.AddModelError("Status_ID", "Status is Required");
            if (!ModelState.IsValid)
            {
                return View();
            }

            try
            {
                db.Add(myProject);
                db.Save();
                return RedirectToAction("Index");

            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", "Error: " + ex.Message);
                return View();
            }
        }
예제 #6
0
        // [HttpPost]
        public ActionResult TestForm(/*[Bind(Exclude="Logintime")]GuestbookForm gbook*/
            /*FormCollection form*/)
        {
            //  if ( !ModelState.IsValid ) {
              //  return View();
              //  }
            //ViewData.Model = form["Confirmedpassword"];
               // return RedirectToAction("Index", "Home");

            //GuestbookForm gbook = new GuestbookForm();
            ////UpdateModel<GuestbookForm>(gbook);
            //if (!TryUpdateModel<GuestbookForm>(gbook))
            //{
            //    // 模型連結發生失敗
            //    return View();
            //}

            //return Redirect("/");
            ///////////////////////
            //Dictionary<string, object> attr = new Dictionary<string, object>();
            //attr.Add("size", "16");
            //attr.Add("style", "color:red;");
            //ViewData["Dictionary"] = attr;

            //////////////////////
            List<SelectListItem> listItem = new List<SelectListItem>();
            listItem.Add(new SelectListItem { Text ="是", Value = "1"});
            listItem.Add(new SelectListItem { Text = "否", Value = "0" });

            ViewData["List"] = new SelectList(listItem, "Value", "Text", "");

            return View();
        }
        public ActionResult EditDocument()
        {
            
            if (RouteData.Values["id"] != null)
            {
                int nid = 0;
                bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                if (isnumber)
                {
                    Document record = DocumentManager.GetDocumentById(nid);
                    var languages = LanguageManager.GetLanguages();
                    var list = new SelectList(languages, "Culture", "Language", record.Language);
                    ViewBag.LanguageList = list;
                    var groups = DocumentManager.GetDocumentGroupList(record.Language);
                    var grouplist = new SelectList(groups, "DocumentGroupId", "GroupName", record.DocumentGroupId);
                    ViewBag.GroupList = grouplist;
                    return View(record);
                }
                else
                    return View();
            }
            else
                return View();

        }
예제 #8
0
        public ActionResult GetBatch(int departmentid, int campusid)
        {
            var id = _work.EnrollDep.Find(x => x.Depid == departmentid && x.Campid == campusid).Select(x => x.DepEnrolId);
            int enrollid = id.Single();

            IEnumerable<CourseToDep> subject = _work.CourseToDep.Find(x => x.DepEnrolId == enrollid);

            Course s = new Course();
            IEnumerable<EnrollBatch> b = _work.EnrollBatch.Find(x => x.DepEnrolId == enrollid);
            List<Course> listcourse = new List<Course>();
            foreach(var values in subject )
            {
                Course C = _work.Course.GetById(values.CId);
                listcourse.Add(C);
            }
            List<Batch> batch = new List<Batch>();
            foreach (var x in b)
            {
                batch.Add(x.batch);
            }

            // }

            var course= new SelectList(listcourse, "CId", "SubName");
            var batches = new SelectList(batch, "batch_id", "batch_name");
              object list= new
              {

              departs = batches,
              courses = course
              };

            return Json(list, JsonRequestBehavior.AllowGet);
        }
예제 #9
0
        public ActionResult Create()
        {
            var categoryList = new SelectList(new[] { "Automotive", "Electronincs", "Games", "Home" });

            ViewBag.categoryList = categoryList;
            return View();
        }
예제 #10
0
 public TicketVM()
 {
     error = "";
     types = TicketType.GetTicketTypes();
     ticket = new Ticket();
     typeList = new SelectList(types, "ID", "Name", SelectedType);
 }
예제 #11
0
 public AbstractEventViewModel()
 {
     StartDate = DateTime.Today.Date.ToString("MM-dd-yyyy");
     EndDate = DateTime.Today.Date.ToString("MM-dd-yyyy");
     StartTimes = new SelectList(Constants.Constants.GetTimes(), "Value", "Key");
     EndTimes = new SelectList(Constants.Constants.GetTimes(), "Value", "Key");
 }
예제 #12
0
        //
        // GET: /Survey/Approve/5
        public ActionResult Approve(int id)
        {
            try
            {
                if (Session["UserAccountID"] == null)
                    return RedirectToAction("Validate", "Login");
                User user = (User)Session["User"];
                ViewData["LoginInfo"] = Utility.BuildUserAccountString(user.Username, Convert.ToString(Session["UserAccountName"]));
                if (user.IsAdmin)
                    ViewData["txtIsAdmin"] = "true";
                else
                    ViewData["txtIsAdmin"] = "false";

                Survey survey = repository.GetSurvey(id);
                ViewData["ValidationMessage"] = String.Empty;

                IImageRepository imgrep = new EntityImageRepository();
                Image img = imgrep.GetImage(survey.SurveyImageID);
                ViewData["ImageList"] = new SelectList(BuildImageList(img.StoredFilename), "Value", "Text", img.StoredFilename);
                ViewData["ImageUrl"] = selectedfile;
                ViewData["ImageFolder"] = ConfigurationManager.AppSettings["MediaRootFolder"] + Convert.ToString(Session["UserAccountID"]) + @"/Images/";

                ViewData["SurveyTable"] = BuildSurveyTableNoLinks(survey);

                return View(survey);
            }
            catch (Exception ex)
            {
                Helpers.SetupApplicationError("Survey", "Approve", ex.Message);
                return RedirectToAction("Index", "ApplicationError");
            }
        }
        /// <summary>
        /// Create calculator view model with dependencies
        /// </summary>
        /// <param name="ninjaCommander"></param>
        public CalculatorViewModel(INinjaCommander ninjaCommander)
        {
            _ninjaCommander = ninjaCommander;

            Ninjas = new SelectList(_ninjaCommander.Ninjas, "Description", "Description");
            Opponents = new SelectList(_ninjaCommander.Opponents, "Description", "Description");
        }
예제 #14
0
        //
        // GET: /Admin/Posts/Edit/5
        public ActionResult Edit(string id)
        {
            Post post = _postRpository.FindById(id);
            ViewData["Blogs"] = new SelectList(_blogRepository.FindAll(), "Id", "Name", post.Id);

            return View(post);
        }
예제 #15
0
        public ActionResult Create(CompanyAdvice companyAdvice, FormCollection form)
        {
            if (companyAdvice.CompanysId == null)
            {
                ModelState.AddModelError("CompanysId", "Please choose a company.");
            }
            ValidateAdvice(companyAdvice);

            if (ModelState.IsValid)
            {
                try
                {
                    _adviceApplicationService.AddCompanyAdvice(CurrentMentor, companyAdvice);

                    return RedirectToAction("Index", "Advice");
                }
                catch
                {
                    return RedirectToAction("Create");
                }
            }

            var companies = _companyApplicationService.GetAllCompanies();
            ViewData["Companies"] = new SelectList(companies, "Id", "CompanyName", companyAdvice.CompanysId);
            ViewData["Semaphores"] = _semaphoreApplicationService.GetAllSemaphores();
            SetAdviceTagViewData();
            return View(companyAdvice);
        }
예제 #16
0
        public static MvcHtmlString RadioButtonList(this HtmlHelper htmlHelper, string name, string selectedValue, IEnumerable <SelectListItem> items)
        {
            var           selectList = new System.Web.Mvc.SelectList(items);
            MvcHtmlString html       = MvcHtmlString.Create(option(name, selectedValue, items));

            return(html);// htmlHelper.RadioButtonList(name, selectList);
        }
예제 #17
0
        public IndexViewModel()
        {
            ConsentValidFromStart = new OptionalDateInputViewModel(allowPastDates: true, showLabels: false);
            ConsentValidFromEnd = new OptionalDateInputViewModel(allowPastDates: true, showLabels: false);
            ConsentValidToStart = new OptionalDateInputViewModel(allowPastDates: true, showLabels: false);
            ConsentValidToEnd = new OptionalDateInputViewModel(allowPastDates: true, showLabels: false);
            NotificationReceivedStart = new OptionalDateInputViewModel(allowPastDates: true, showLabels: false);
            NotificationReceivedEnd = new OptionalDateInputViewModel(allowPastDates: true, showLabels: false);
            NotificationTypes = new SelectList(EnumHelper.GetValues(typeof(NotificationType)), dataTextField: "Value", dataValueField: "Key");
            TradeDirections = new SelectList(EnumHelper.GetValues(typeof(TradeDirection)), dataTextField: "Value", dataValueField: "Key");
            InterimStatus = new SelectList(new[]
            {
                new SelectListItem
                {
                    Text = "Interim",
                    Value = "true"
                },
                new SelectListItem
                {
                    Text = "Non-interim",
                    Value = "false"
                }
            }, dataTextField: "Text", dataValueField: "Value");
            OperationCodes = new MultiSelectList(EnumHelper.GetValues(typeof(OperationCode)), dataTextField: "Value", dataValueField: "Key");

            NotificationStatuses = new SelectList(GetCombinedNotificationStatuses(), dataTextField: "Name", dataValueField: "StatusId", dataGroupField: "TradeDirection", selectedValue: null);

            SelectedOperationCodes = new OperationCode[] { };
        }
예제 #18
0
        public SelectList getParentPages(int selectedPageID)
        {
            contentCMSDBDataContext db = new contentCMSDBDataContext();
            var parentPages = from pp in db.pages where pp.parent == 0 && pp.isPublished == true select pp;

            List<object> parentPagesList = new List<object>();
            parentPagesList.Add(new
            {
                Id = 0,
                Name = "None",
                SelectedValue = 0
            });
            foreach (var item in parentPages)
            {
                parentPagesList.Add(new
                {
                    Id = item.pageID,
                    Name = item.pageTitle,
                    SelectedValue = item.pageID
                });
            }

            SelectList newSL = new SelectList(parentPagesList, "Id", "Name", selectedPageID);
            return newSL;
        }
예제 #19
0
        /// <summary>
        /// 企业会员
        /// </summary>
        /// <returns></returns>
        public ActionResult companyRegister()
        {
            var modelList = _regionBase.GetModelList(" reg_PId = 0");

            List<SelectListItem> selectType = new List<SelectListItem>();
            selectType = new List<SelectListItem> { new SelectListItem { Text = "请选择", Value = "chose" } };
            foreach (var model in modelList)
            {
                selectType.Add(new SelectListItem
                {
                    Value = model.reg_Code.ToString(),
                    Text = model.reg_Name
                });
            }
            ViewData["selectType"] = new SelectList(selectType, "Value", "Text", "请选择");
            List<SelectListItem> selectType2 = new List<SelectListItem>();
            selectType2 = new List<SelectListItem> { new SelectListItem { Text = "请选择", Value = "chose" } };
            ViewData["selectType2"] = new SelectList(selectType2, "Value", "Text", "请选择");
            List<SelectListItem> selectType3 = new List<SelectListItem>();
            selectType3 = new List<SelectListItem> { new SelectListItem { Text = "请选择", Value = "chose" } };
            ViewData["selectType3"] = new SelectList(selectType3, "Value", "Text", "请选择");

            var xieyi = _newsBase.GetModelList(" n_Title='企业注册协议'  and n_StatusCode=0 and n_IsDel=0");
            if (xieyi != null && xieyi.Any())
            {
                ViewBag.xieyi = xieyi[0].n_Content;
            }
            else
            {
                ViewBag.xieyi = "暂无注册协议";
            }
            return View();
        }
        public ActionResult Edit()
        {
            //1. Pasamos valores al Modelo del servicio
            List<AprobarWS.Aprobar> viaticos = proxy.ListarSolicitudes();
            AprobarWS.Aprobar viaticoEditar = new AprobarWS.Aprobar();

            viaticoEditar.CodigoSolicitud = viaticos[0].CodigoSolicitud;
            viaticoEditar.FechaSolicitud = viaticos[0].FechaSolicitud;
            viaticoEditar.ubigeoOrigen = viaticos[0].ubigeoOrigen;
            viaticoEditar.ubigeoDestino = viaticos[0].ubigeoDestino;
            viaticoEditar.FechaSalida = viaticos[0].FechaSalida;
            viaticoEditar.FechaRetorno = viaticos[0].FechaRetorno;
            viaticoEditar.SustentoViaje = viaticos[0].SustentoViaje;
            viaticoEditar.TotalSolicitado = viaticos[0].TotalSolicitado;
            

            //3. Llenar combobox de Estado
            var list = new[] {   
                new Estado { Id = "P", Name = "Pendiente" }, 
                new Estado { Id = "A", Name = "Aprobado" }
            };
            var listEstados = new SelectList(list, "Id", "Name");
            ViewData["estados"] = listEstados;

            return View(viaticoEditar);
        }              
예제 #21
0
        public ActionResult CreatePost()
        {
            SelectList Users = new System.Web.Mvc.SelectList(db.Users, "IdUser", "Name");

            ViewBag.Us = Users;
            return(View());
        }
예제 #22
0
 public ActionResult Edit(int id)
 {
     var transaction = repository.Get<Transaction>(id);
     var users = repository.List<User>();
     ViewData["users"] = new SelectList(users, "Id", "Name", transaction.Who.Id);
     return View(transaction);
 }
        public UserList(string selectedValue, int companyId)
        {
            using (var dbContext = new SchTimeTrackingEntities())
            {
                var ulist = dbContext.UserProfiles.Where(c => c.CompanyId.Equals(companyId));

                SelectedValue = selectedValue;
                List<HBS.Entities.UserProfile> userprofile = new List<HBS.Entities.UserProfile>();
                foreach (UserProfile item in ulist)
                {
                    userprofile.Add(new HBS.Entities.UserProfile(item.CompanyId, item.UserName, item.Password, item.FirstName, item.LastName, item.Email, item.UserId, (item.RoleId.HasValue ? item.RoleId.Value : 0)));
                }
                //List<SelectListItem> items = new List<SelectListItem>();
                //foreach (var item in userprofile)
                //{
                //    if (SelectedValue.Equals(item.UserName))
                //    {
                //        items.Add(new SelectListItem() { Text = item.UserName, Value = item.UserId.ToString(), Selected = true });
                //    }
                //    else
                //        items.Add(new SelectListItem() { Text = item.UserName, Value = item.UserId.ToString() });
                //}
                if (!string.IsNullOrEmpty(SelectedValue))
                    Users = new SelectList(userprofile, "UserId", "UserName", selectedValue);
                else
                    Users = new SelectList(userprofile, "UserId", "UserName");
                //Users = items
            }
        }
예제 #24
0
 public ActionResult Create()
 {
     var user = User.Identity.GetUserId();
     ViewData["TutorialSelection"] = new SelectList(db.Tutorials.Where(x => x.EducatorId == user).ToList(), "Title", "Title");
     //do something to link tutID and quizID
     return View();
 }
 public ActionResult Create()
 {
     ViewData["ddGrupos"] = new SelectList(new[] { "(Selecciona)" });
     ViewData["ddEmpresas"] = new SelectList(new[] { "(Selecciona)" });
     ViewData["ddPerfiles"] = new SelectList(new[] { "(Selecciona)" });
     return View();
 }
예제 #26
0
        public ActionResult Create()
        {
            List<Category> result = this._rep.GetCategories().ToList();
            SelectList select = new SelectList(result, "Id", "Name");

            return View(select);
        }
예제 #27
0
 private static ViewDataDictionary GetViewDataWithSelectList() {
     ViewDataDictionary viewData = new ViewDataDictionary();
     SelectList selectList = new SelectList(MultiSelectListTest.GetSampleAnonymousObjects(), "Letter", "FullWord", "C");
     viewData["foo"] = selectList;
     viewData["foo.bar"] = selectList;
     return viewData;
 }
예제 #28
0
        public ActionResult Create(string name, string text, string category)
        {
            try
            {
                if((name == "") || (text == "")) throw new ArgumentException("Name/Text");

                Comment newComment = new Comment();
                newComment.Name = name;
                newComment.Text = text;
                newComment.Category = new Category();
                newComment.Category.Id = new Guid(category);

                this._rep.CreateComment(newComment);
                return RedirectToAction("Index");
            }
            catch
            {
                if (name == "") ModelState.AddModelError("Name", "Set Name");
                if (text == "") ModelState.AddModelError("Text", "Set Text");

                List<Category> result = this._rep.GetCategories().ToList();
                SelectList select = new SelectList(result, "Id", "Name");

                return View(select);
            }
        }
        public static void SetViewDataForDate(ViewDataDictionary ViewData)
        {
            List<string> genderList = new List<string>();
            genderList.Add("Male");
            genderList.Add("Female");
            SelectList list = new SelectList(genderList);
            ViewData["gender"] = list;

            int[] dayA = new int[31];

            for (int i = 0; i < 31; i++)
            {
                dayA[i] = i + 1;
            }

            int[] yearA = new int[100];

            for (int i = 0; i < 100; i++)
            {
                yearA[i] = DateTime.Now.Year - i;
            }

            SelectList daySL = new SelectList(dayA);
            ViewData["days"] = daySL;

            SelectList yearSL = new SelectList(yearA);
            ViewData["years"] = yearSL;
        }
예제 #30
0
        public ActionResult EditLink(ImportantLinks model)
        {
            var languages = LanguageManager.GetLanguages();
            var list = new SelectList(languages, "Culture", "Language");
            ViewBag.LanguageList = list;

            if (ModelState.IsValid)
            {
               
                if (RouteData.Values["id"] != null)
                {
                    int nid = 0;
                    bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                    if (isnumber)
                    {
                        model.LinkId = nid;
                        ViewBag.ProcessMessage = LinkManager.EditImportantLink(model);
                        return View(model);
                    }
                    else
                    {
                        ViewBag.ProcessMessage = false;
                        return View(model);
                    }
                }
                else return View();
            }
            else
                return View();

            return View();
        }
예제 #31
0
        public IndexViewModel()
        {
            From = new OptionalDateInputViewModel(true);
            To = new OptionalDateInputViewModel(true);

            DateSelectList = new SelectList(EnumHelper.GetValues(typeof(MissingShipmentsReportDates)), "Key", "Value", null);
        }
        public ActionResult Create(Form model, FormCollection collection)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    FormsRepository.Add(model);
                    FormsRepository.Save();
                    return RedirectToAction("Index");
                }
                string mailViews = Server.MapPath("~/Views/UserMailer");
                List<string> mailViewList = new List<string>();
                foreach (string file in Directory.GetFiles(mailViews))
                {
                    mailViewList.Add(Path.GetFileNameWithoutExtension(file));
                }
                SelectList mails = new SelectList(mailViewList);
                ViewBag.EmailViews = mails;

                return View(model);
            }
            catch
            {
                return View();
            }
        }
예제 #33
0
        public ActionResult CreateUser()
        {
            //User user = db.Users.Find(4);
            SelectList roles = new System.Web.Mvc.SelectList(db.Roles, "IdRole", "Role");

            ViewBag.Rol = roles;
            return(View( ));
        }
예제 #34
0
        public ActionResult Create()
        {
            var dicList = JpmSoftComponent.Dic.Dictionary.ListDictionaryValueByTypeCode("JPMsoft_XSXB", CurrentMember.Solution);

            ViewData["dicList"] = new System.Web.Mvc.SelectList(dicList, "D_Code", "D_Name", "");
            Utility.JPMContract.Student com = new Utility.JPMContract.Student();
            CurrentStartFlow.Template = com.SysTemplateCode;
            Code.JPMFileHelper.ClearCurrentCreateFileAnnex();
            Code.JPMFileHelper.ClearCurrentFileWordList();
            return(View());
        }
예제 #35
0
        //[MyAuthorize(Roles = "Admin")]
        public ActionResult Edit(string name)
        {
            UserProfile userprofile = db.UserProfiles.Find(WebSecurity.GetUserId(name));

            if (userprofile == null)
            {
                return(HttpNotFound());
            }
            IEnumerable <SelectListItem> RolesList = new System.Web.Mvc.SelectList(System.Web.Security.Roles.GetAllRoles(), "RoleName");

            ViewData["RoleName"] = RolesList;
            GetProjectNameForBreadcrumbs(userprofile);
            return(View(userprofile));
        }
예제 #36
0
        public JsonResult GetCountriesIndex()
        {
            var CountriesJson = America.GetCountries();
            var Countries     = JsonConvert.DeserializeObject <List <Countries> >(CountriesJson);

            if (Countries.Count > 0)
            {
                var ModeloList = new System.Web.Mvc.SelectList(Countries, "Id", "Name");
                return(Json(new { Key = Countries.FirstOrDefault().Id, Tabla = ModeloList }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("", JsonRequestBehavior.AllowGet));
            }
        }
예제 #37
0
        public ActionResult Edit(int?id)
        {
            SelectList roles = new System.Web.Mvc.SelectList(db.Roles, "IdRole", "Role");

            ViewBag.Rol = roles;

            if (id == null)
            {
                return(HttpNotFound());
            }
            User user = db.Users.Find(id);

            if (user != null)
            {
                return(View(user));
            }
            return(HttpNotFound());
        }
예제 #38
0
 public JsonResult GetProvincesIndex(int Id_Country)
 {
     if (Id_Country != 0)
     {
         var ProvincesJson = America.GetProvinces(Id_Country: Id_Country);
         var Provinces     = JsonConvert.DeserializeObject <List <Provinces> >(ProvincesJson);
         if (Provinces.Count > 0)
         {
             var ModeloList = new System.Web.Mvc.SelectList(Provinces, "Id", "Name");
             return(Json(new { Key = Provinces.FirstOrDefault().Id, Tabla = ModeloList }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json("", JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         return(Json("", JsonRequestBehavior.AllowGet));
     }
 }
예제 #39
0
        public static System.Web.WebPages.HelperResult DropDownBuilder(System.Web.Mvc.HtmlHelper html, string ID, System.Collections.IList lista, bool todos, string displayMember, string valueMember)
        {
#line default
#line hidden
            return(new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 90 "C:\Proyectos .NET\GrupoFournier\MvcCustomHelpers\Views\Helpers\DropDownListHelper.cshtml"

// -- Seteamos el valor seleccionado por defecto
                long?selectedValue = null;

// -- Si en el ViewBag hay un selected
                if (html.ViewData[string.Format("selected{0}", ID)] != null)
                {
                    // -- Seteo el selected
                    selectedValue = Convert.ToInt64(html.ViewData[string.Format("selected{0}", ID)]);
                }

// -- Convierto la lista a dropDownList
                var dropDownListItems = DropDownListConvertor.ListToDropDownListItemList(lista, displayMember, valueMember);

// -- Creo la lista de select items
                var listsItems = new System.Web.Mvc.SelectList(dropDownListItems, "Valor", "Texto", selectedValue);

                if (todos)
                {
                    // -- Muestro el combo


#line default
#line hidden

#line 111 "C:\Proyectos .NET\GrupoFournier\MvcCustomHelpers\Views\Helpers\DropDownListHelper.cshtml"
                    WriteTo(__razor_helper_writer, html.DropDownList(ID, listsItems, "-- TODOS --", htmlAttributes: new { @class = "form-control select2" }));


#line default
#line hidden

#line 111 "C:\Proyectos .NET\GrupoFournier\MvcCustomHelpers\Views\Helpers\DropDownListHelper.cshtml"
                }
                else
                {
                    // -- Muestro el combo


#line default
#line hidden

#line 116 "C:\Proyectos .NET\GrupoFournier\MvcCustomHelpers\Views\Helpers\DropDownListHelper.cshtml"
                    WriteTo(__razor_helper_writer, html.DropDownList(ID, listsItems, htmlAttributes: new { @class = "form-control select2" }));


#line default
#line hidden

#line 116 "C:\Proyectos .NET\GrupoFournier\MvcCustomHelpers\Views\Helpers\DropDownListHelper.cshtml"
                }


#line default
#line hidden
            }));

#line 118 "C:\Proyectos .NET\GrupoFournier\MvcCustomHelpers\Views\Helpers\DropDownListHelper.cshtml"
        }