public JsonResult UpdateInfo(TabUpdateRequestModel request) { JsonResponse json = new JsonResponse(); try { TabUpdateResponseModel response = new TabUpdateResponseModel(); response.ReleasePath = Properties.Settings.Default.ReleasesPath; using (SimpleImpersonation.Impersonation.LogonUser(request.Dominio, request.Usuario, request.Password, _logonType)) { //Releases List <string> list = new List <string>(); System.IO.DirectoryInfo dirInfo = new DirectoryInfo(response.ReleasePath); foreach (System.IO.DirectoryInfo dir in dirInfo.GetDirectories()) { list.Add(dir.Name); } string selected = ""; if (list.Count > 0) { selected = list[list.Count - 1]; } response.Releases = new SelectList(list, selected); // Versiones list = new List <string>(); if (selected != "") { dirInfo = new DirectoryInfo(string.Format("{0}\\{1}", response.ReleasePath, selected)); foreach (System.IO.DirectoryInfo dir in dirInfo.GetDirectories()) { list.Add(dir.Name); } } response.Versiones = new SelectList(list); } json.IsSuccess = true; json.Data = response; } catch (Exception ex) { json.IsFail = true; json.Message = ex.Message; } return(Json(json, JsonRequestBehavior.AllowGet)); }
public PartialViewResult TabUpdate(TabUpdateRequestModel request) { TabUpdateResponseModel response = new TabUpdateResponseModel(); response.ReleasePath = Properties.Settings.Default.ReleasesPath; using (SimpleImpersonation.Impersonation.LogonUser(request.Dominio, request.Usuario, request.Password, _logonType)) { //Releases List <string> list = new List <string>(); System.IO.DirectoryInfo dirInfo = new DirectoryInfo(response.ReleasePath); foreach (System.IO.DirectoryInfo dir in dirInfo.GetDirectories()) { list.Add(dir.Name); } string selected = ""; if (list.Count > 0) { selected = list[list.Count - 1]; } response.Releases = new SelectList(list, selected); // Versiones list = new List <string>(); if (selected != "") { dirInfo = new DirectoryInfo(string.Format("{0}\\{1}", response.ReleasePath, selected)); foreach (System.IO.DirectoryInfo dir in dirInfo.GetDirectories()) { list.Add(dir.Name); } } response.Versiones = new SelectList(list); } return(PartialView(response)); }