public ActionResult Insert() { ViewBag.Message = "Your app description page."; DropdownModel model = new DropdownModel(); DropdownModel modelAnimal = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); model = myGetLookups.GeLookupAnimal(); ViewData["animalTypeData"] = model.items; Story myStory = new Story(); myStory.animalCombo = model; //modelAnimal = model; model = myGetLookups.GeLookupMoral(); ViewData["moralTypeData"] = model.items; model = myGetLookups.GeLookupStorySource(); ViewData["storySourceData"] = model.items; model = myGetLookups.GeLookupJakataMaster(); ViewData["jakataMasterData"] = model.items; return(View(myStory)); }
protected override void SetupView() { var options1 = new DropdownModel[Constants.TIME_OPTIONS_COUNT + 1]; var options2 = new DropdownModel[Constants.TIME_OPTIONS_COUNT + 1]; for (int i = 0; i < Constants.TIME_OPTIONS_COUNT; i++) { options1[i + 1] = new DropdownModel { Id = i, Text = (i + 1).ToString() }; options2[i + 1] = new DropdownModel { Id = i, Text = (i + 1).ToString() }; } var defaultModel = new DropdownModel { Id = -1, Text = "--" }; options1[0] = defaultModel; options2[0] = defaultModel; _listOfOptions1 = options1; _listOfOptions2 = options2; _optionButton1.RectMinSize = new Vector2(84, 49); _optionButton2.RectMinSize = new Vector2(84, 49); _optionButton1.RectPosition = new Vector2(0, 150); _optionButton2.RectPosition = new Vector2(235, 100); _background.Texture = (Texture)GD.Load($"{_resourcesPath}background.png"); _background.Position = new Vector2(150, 203); }
public ActionResult UpdateProject() { ViewBag.Message = "Your app description page."; DropdownModel model = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); model = myGetLookups.GeLookupSpecificStoryDropdown(); ViewData["jakataMasterData"] = model.items; model = myGetLookups.GeLookupCatUsers(2); model.items.Add(new SelectListItem { Text = "Please Select ", Value = "0" }); //model.items.Add ViewData["newReadersData"] = model.items; DropdownModel modelExisting = new DropdownModel(); ViewData["existingReaderData"] = modelExisting.items; return(View()); }
public ActionResult Project() { ViewBag.Title = "Project"; Story myStory = new Story(); DropdownModel model = new DropdownModel(); DropdownModel modelAnimal = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); model = myGetLookups.GeLookupCatUsers(1); myStory.IllustrationsCombo = model; //ViewData["IllustrationsData"] = model.items; model = myGetLookups.GeLookupCatUsers(2); myStory.ReadersCombo = model; //ViewData["ReadersData"] = model.items; model = myGetLookups.GeLookupCatUsers(3); myStory.MusicCombo = model; //ViewData["MusicData"] = model.items; model = myGetLookups.GeLookupCatUsers(4); myStory.DanceCombo = model; //ViewData["DanceData"] = model.items; model = myGetLookups.GeLookupCatUsers(5); myStory.AdminCombo = model; //ViewData["AdminData"] = model.items; model = myGetLookups.GeLookupJakataMaster(); ViewData["jakataMasterData"] = model.items; return(View(myStory)); }
public string GetStoryCategoryNameByID(int id) { using (var client = new System.Net.Http.HttpClient()) { var env = ConfigurationManager.AppSettings["Enviroment"]; var settings = ""; var uri = new Uri("http://api.jataka.fun/api/StoryCategorytName/GetStoryCategoryNameByID?id=" + id); if (env == "Dev") { settings = ConfigurationManager.AppSettings["LocalWebApi"]; uri = new Uri("http://localhost:5187/api/StoryCategorytName/GetStoryCategoryNameByID?id=" + id); } else { settings = ConfigurationManager.AppSettings["ProductionWebApi"]; uri = new Uri("http://api.jataka.fun/api/StoryCategorytName/GetStoryCategoryNameByID?id=" + id); } var response = client.GetAsync(uri).Result; var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var x = JObject.Parse(responseString); XNode node = JsonConvert.DeserializeXNode(x.ToString(), "data"); string a = node.ToString(); string trima = a.Replace("\r\n", ""); trima = a.Replace("{", ""); trima = a.Replace("}", ""); DropdownModel model = new DropdownModel(); //Model.items.Add(new SelectListItem { Text = "Please Select ", Value = "0" }); XDocument xml = XDocument.Parse(trima); model.items.Add(new SelectListItem { Text = "Please Select ", Value = "0" }); string StoryCategorytName = ""; foreach (var el in xml.Descendants("storyCategorytNameLists")) { StoryCategorytName = el.Element("StoryCategorytName").Value; } return(StoryCategorytName); //ViewData["animalTypeData"] = model.items; } }
public async Task <ActionResult> PopulateParentObjectLevelDropDownList(DropdownModel objModel, CancellationToken cancellationToken) { IDropdownModel model = await _service.PopulateParentObjectLevelDropDownListAsync(objModel, GetCanellationToken(cancellationToken)); model.DropdownList[0].Identifier = "ddlParentObject"; return(PartialView("~/Views/Shared/_Partial/_ddlWithClick.cshtml", model.DropdownList)); }
//public async Task<object> GetAnimal() //{ // HttpClient client = new HttpClient { BaseAddress = new Uri("https://localhost:44302/") }; // try // { // client.DefaultRequestHeaders.Accept.Clear(); // var response = await client.GetAsync("api/AnimalType"); // var httpContent = response.Content; // var result = await httpContent.ReadAsStringAsync(); // var variables = JsonConvert.DeserializeObject(result); // return variables; // //return Ok(variables); // } // catch (Exception ex) // { // int o = 0; // return null; // } //} //public async Task<DropdownModel> BasicCallAsync() public DropdownModel GeLookupAnimal() { using (var client = new System.Net.Http.HttpClient()) { //.net web api //var uri = new Uri("https://localhost:44302/api/AnimalType/"); //.net core web api var uri = new Uri("https://localhost:44302/api/AnimalType/"); var response = client.GetAsync(uri).Result; //var content = await client.GetStringAsync("https://localhost:44302/api/AnimalType"); var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var x = JObject.Parse(responseString); XNode node = JsonConvert.DeserializeXNode(x.ToString(), "data"); string a = node.ToString(); string trima = a.Replace("\r\n", ""); trima = a.Replace("{", ""); trima = a.Replace("}", ""); DropdownModel model = new DropdownModel(); //Model.items.Add(new SelectListItem { Text = "Please Select ", Value = "0" }); XDocument xml = XDocument.Parse(trima); foreach (var el in xml.Descendants("animalTypeLists")) { string ID = el.Element("ID").Value; string AnimalType = el.Element("AnimalType").Value; model.items.Add(new SelectListItem { Text = AnimalType, Value = ID }); } var animalType = ""; foreach (SelectListItem s in model.items) { if (s.Value == animalType) { s.Selected = true; } } return(model); //ViewData["animalTypeData"] = model.items; } }
public ActionResult <CreateCourseDropdownModel> GetSubcategories(DropdownModel inputModel) { var subcategories = this.categoriesService.GetSubcategoriesAsSelectListItems(int.Parse(inputModel.CategoryId)); var resultObj = new CreateCourseDropdownModel { Subcategories = subcategories }; return(resultObj); }
public ActionResult UpdateUser(FormCollection form) { string userID = base.Request.Form["idPhoto"]; ViewData["userID"] = userID; GetStories myGetStories = new GetStories(); var email = myGetStories.GetMothersEmail(Convert.ToInt16(userID)); //if (email =="") //{ // email = "Enter the email address"; //} ViewData["email"] = email.ToString(); string userName = base.Request.Form["userName"]; //ViewData["userName"] = userName; MothersHelpersSpecificList myMothersHelpersSpecificList = new MothersHelpersSpecificList(); myMothersHelpersSpecificList = myGetStories.GetMothersHelpersTypeSpecific(Convert.ToInt16(userID)); DropdownModel model = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); Story myStory = new Story(); myStory.userName = userName; model = myGetLookups.GetMothersHelpersType(); for (int i = 0; i < myMothersHelpersSpecificList.mothersHelpersSpecificLists.Count; i++) { var x = myMothersHelpersSpecificList.mothersHelpersSpecificLists[i].MothersHelpersType; foreach (SelectListItem s in model.items) { if (s.Value == x) { s.Selected = true; } } } ViewData["MothersHelpersTypeData"] = model.items; myStory.MothersHelpersTypeCombo = model; return(View(myStory)); }
public DropdownModel GetYouTube(int row, int userID) { using (var client = new System.Net.Http.HttpClient()) { var env = ConfigurationManager.AppSettings["Enviroment"]; var settings = ""; var uri = new Uri("http://api.jataka.fun/api/YouTube/getYouTube/?ID=" + row + "&UserID=" + userID); if (env == "Dev") { settings = ConfigurationManager.AppSettings["LocalWebApi"]; uri = new Uri("http://localhost:5187/api/YouTube/getYouTube/?ID=" + row + "&UserID=" + userID); } else { settings = ConfigurationManager.AppSettings["ProductionWebApi"]; uri = new Uri("http://api.jataka.fun/api/YouTube/getYouTube/?ID=" + row + "&UserID=" + userID); } var response = client.GetAsync(uri).Result; var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var x = JObject.Parse(responseString); XNode node = JsonConvert.DeserializeXNode(x.ToString(), "data"); string a = node.ToString(); string trima = a.Replace("\r\n", ""); trima = a.Replace("{", ""); trima = a.Replace("}", ""); DropdownModel model = new DropdownModel(); XDocument xml = XDocument.Parse(trima); foreach (var el in xml.Descendants("youTubeLists")) { string ID = el.Element("JakataID").Value; string title = el.Element("URL").Value; model.items.Add(new SelectListItem { Text = title, Value = ID }); } return(model); } }
public DropdownModel GetYouTube(int row) { using (var client = new System.Net.Http.HttpClient()) { var uri = new Uri("http://localhost:5187/api/YouTube/" + row); var response = client.GetAsync(uri).Result; var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var x = JObject.Parse(responseString); XNode node = JsonConvert.DeserializeXNode(x.ToString(), "data"); string a = node.ToString(); string trima = a.Replace("\r\n", ""); trima = a.Replace("{", ""); trima = a.Replace("}", ""); DropdownModel model = new DropdownModel(); XDocument xml = XDocument.Parse(trima); foreach (var el in xml.Descendants("youTubeLists")) { string ID = el.Element("JakataID").Value; string title = el.Element("URL").Value; model.items.Add(new SelectListItem { Text = title, Value = ID }); } //youTubeModel modelStory = new youTubeModel(); //XDocument xml = XDocument.Parse(trima); //foreach (var el in xml.Descendants("youTubeLists")) //{ // modelStory.ID = el.Element("ID").Value; // modelStory.JakataID = el.Element("JakataID").Value; // modelStory.URL = el.Element("URL").Value; //} return(model); } }
public static void Dropdown(DropdownModel table) { List <string> list = Read.Dropdown(table.NameOfTable, "Name=" + table.Name); if (list != null) { return; } string insert = SqliteQuery.Create(table.NameOfTable, "Name"); SqliteDataAccess.ExecuteQuery(insert, table); }
public ActionResult UpdateStory() { ViewBag.Message = "Your app description page."; DropdownModel model = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); model = myGetLookups.GeLookupSpecificStoryDropdown(); ViewData["jakataMasterData"] = model.items; return(View()); }
protected override void SetupView() { var options1 = new DropdownModel[Constants.TIME_OPTIONS_COUNT + 1]; var options2 = new DropdownModel[Constants.TIME_OPTIONS_COUNT + 1]; for (int i = 0; i < Constants.TIME_OPTIONS_COUNT; i++) { options1[i + 1] = new DropdownModel { Id = i, Text = (i * 2).ToString() }; options2[i + 1] = new DropdownModel { Id = i, Text = (i * 5).ToString("00") }; } var defaultModel = new DropdownModel { Id = -1, Text = "--" }; options1[0] = defaultModel; options2[0] = defaultModel; _listOfOptions1 = options1; _listOfOptions2 = options2; _optionButton1.RectMinSize = new Vector2(84, 49); _optionButton2.RectMinSize = new Vector2(84, 49); _optionButton1.RectPosition = new Vector2(40, 50); _optionButton2.RectPosition = new Vector2(165, 50); _background.Texture = (Texture)GD.Load($"{_resourcesPath}time_background.png"); _background.Position = new Vector2(156, 0); var fontLight = (DynamicFont)GD.Load($"{_resourcesPath}montserrat_light.tres"); fontLight.Size = 24; _title.AddFontOverride("font", fontLight); _title.Text = "Čas"; var fontMedium = (DynamicFont)GD.Load($"{_resourcesPath}montserrat_medium.tres"); fontMedium.Size = 24; _label.AddFontOverride("font", fontMedium); _label.Text = ":"; _label.RectPosition = new Vector2(142, 58); _windowWrapper.RectPosition = new Vector2(15, -90); }
public DropdownModel GetStatus(int status1) { using (var client = new System.Net.Http.HttpClient()) { var uri = new Uri("https://localhost:44302/api/ToDo/" + status1); //var uri = new Uri("https://localhost:44302/api/Storiesapi/ToDo/"+status1); //var uri = new Uri("https://localhost:44302/api/JakataMaster/"); var response = client.GetAsync(uri).Result; var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var x = JObject.Parse(responseString); XNode node = JsonConvert.DeserializeXNode(x.ToString(), "data"); string a = node.ToString(); string trima = a.Replace("\r\n", ""); trima = a.Replace("{", ""); trima = a.Replace("}", ""); DropdownModel model = new DropdownModel(); XDocument xml = XDocument.Parse(trima); foreach (var el in xml.Descendants("toDoLists")) { string ID = el.Element("ID").Value; string title = el.Element("Title").Value; model.items.Add(new SelectListItem { Text = title, Value = ID }); } var animalType = ""; foreach (SelectListItem s in model.items) { if (s.Value == animalType) { s.Selected = true; } } return(model); //ViewData["animalTypeData"] = model.items; } }
public JsonResult GetMappingList(int DocumentId) { ViewQuestionModel objViewQuestionModel = new ViewQuestionModel(); QuestionDetailModel objQuestionDetailModel = new QuestionDetailModel(); objQuestionDetailModel.DocumentID = DocumentId; objQuestionDetailModel.StepID = 0; //initial set of current page, pageSize , Total pages objViewQuestionModel.CurrentPage = 1; objViewQuestionModel.TotalPages = 0; objViewQuestionModel.QuestionDetail = objQuestionDetailModel; objViewQuestionModel.QuestionDetail.ID = DocumentId; //Get Question Type List to fill dropdown of Question Type FillQuestionType(); objViewQuestionModel.PageSize = int.MaxValue - 1; //ViewBag.ParentQuestionList List <DropdownModel> objDropdown = new List <DropdownModel>(); List <DropdownModel> objDropdownParent = new List <DropdownModel>(); ViewBag.ParentAnswerList = new SelectList(objDropdownParent, "Id", "Value"); List <DropdownModel> objParentSeSession = new List <DropdownModel>(); //Get Question in Add or Edit Model and also show Question List based on Document and sorting paging parameters serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.Question + "/GetQuestions", objViewQuestionModel); objViewQuestionModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewQuestionModel>().Result : null; foreach (QuestionDetailModel objItem in objViewQuestionModel.QuestionsList) { DropdownModel objDropdownModel = new DropdownModel(); objDropdownModel.ID = objItem.QuestionID; objDropdownModel.Value = objItem.QuestionDescription; if (objItem.QuestionType == CommonUtils.QuestionType.DropDown.ToString() || objItem.QuestionType == CommonUtils.QuestionType.SingleSelect.ToString()) { objParentSeSession.Add(new DropdownModel { ID = objItem.QuestionID, Value = objItem.ParentDDLText }); } objDropdown.Add(objDropdownModel); } Session["ParentSeSession"] = null; Session["ParentSeSession"] = objParentSeSession; ViewBag.ParentQuestionList = new SelectList(objDropdown, "Id", "Value"); return(this.Json(ViewBag.ParentQuestionList, JsonRequestBehavior.AllowGet)); }
public DropdownModel GeLookupCatUsers(int id) { using (var client = new System.Net.Http.HttpClient()) { var uri = new Uri("http://localhost:5187/api/MothersHelpers/getMothersHelpersTypeUsers?id=" + id); var response = client.GetAsync(uri).Result; var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var x = JObject.Parse(responseString); XNode node = JsonConvert.DeserializeXNode(x.ToString(), "data"); string a = node.ToString(); string trima = a.Replace("\r\n", ""); trima = a.Replace("{", ""); trima = a.Replace("}", ""); DropdownModel model = new DropdownModel(); //Model.items.Add(new SelectListItem { Text = "Please Select ", Value = "0" }); XDocument xml = XDocument.Parse(trima); foreach (var el in xml.Descendants("mothersHelpersLists")) { string ID = el.Element("ID").Value; string Name = el.Element("Name").Value; Name = Name.Trim(); model.items.Add(new SelectListItem { Text = Name, Value = ID }); } var animalType = ""; foreach (SelectListItem s in model.items) { if (s.Value == animalType) { s.Selected = true; } } return(model); //ViewData["animalTypeData"] = model.items; } }
public ActionResult NewUser() { ViewBag.Message = "Your app description page."; DropdownModel model = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); GetStories myGetStories = new GetStories(); MothersHelpersSpecificList myMothersHelpersSpecificList = new MothersHelpersSpecificList(); myMothersHelpersSpecificList = myGetStories.GetMothersHelpersTypeSpecific(0); Story myStory = new Story(); model = myGetLookups.GetMothersHelpersType(); myStory.MothersHelpersTypeCombo = model; return(View(myStory)); }
public ActionResult Index() { ViewBag.Title = "Home Page"; DropdownModel model = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); model = myGetLookups.GeLookupCatUsers(0); //model.items.Add(new SelectListItem { Text = "Please Select ", Value = "0" }); ViewData["newReadersData"] = model.items; return(View()); }
public ActionResult User() { ViewBag.Message = "Your app description page."; DropdownModel model = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); model = myGetLookups.GeLookupCatUsers(0); //model.items.Add(new SelectListItem { Text = "Please Select ", Value = "0" }); ViewData["newReadersData"] = model.items; return(View()); }
//public ActionResult SearchAPI() //{ // ViewBag.Message = "Your contact page."; // return View(); //} public ActionResult Search() { ViewBag.Message = "Your contact page."; ViewBag.Message = "Your app description page."; DropdownModel model = new DropdownModel(); DropdownModel model1 = new DropdownModel(); DropdownModel modelAnimal = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); model = myGetLookups.GeLookupAnimal(); ViewData["animalTypeData"] = model.items; Story myStory = new Story(); myStory.animalCombo = model; //modelAnimal = model; model = myGetLookups.GeLookupMoral(); ViewData["moralTypeData"] = model.items; model = myGetLookups.GeLookupStorySource(); ViewData["storySourceData"] = model.items; model = myGetLookups.GeLookupJakataMaster(); //ViewData["jakataMasterData"] = model.items; ViewData["jakataMasterData"] = model1.items; DropdownModel modelUserID = new DropdownModel(); modelUserID = myGetLookups.GeLookupCatUsers(2); //model.items.Add ViewData["newReadersData"] = modelUserID.items; model = myGetLookups.GetStoryCategorytName(); ViewData["StoryCategorytNameData"] = model.items; return(View(myStory)); }
public DropdownModel GetDropdownValues(long TableId) { string path = $"/api/DataObject/getLatestDataJSR?tableID={TableId}"; HttpResponseMessage response = client.GetAsync(path).Result; DropdownModel countryModel = new DropdownModel(); if (response.IsSuccessStatusCode) { countryModel = response.Content.ReadAsAsync <DropdownModel>().Result; countryModel.Result = countryModel.Result .Where(d => !string.IsNullOrEmpty(d.Name) && d.Code > 0) .GroupBy(g => new { g.Code, Name = g.Name.ToUpperInvariant() }) .Select(s => new DropdownValues { Code = s.Key.Code, Name = s.Key.Name }) .ToList(); } return(countryModel); }
public ActionResult Index(int?id) { List <DropdownModel> ddlistItems = new List <DropdownModel>(); List <StoredProject> projectList = facade.GetStoredProjectService().GetAll(); int idCounter = 0; foreach (var item in projectList) { DropdownModel ddm = new DropdownModel(); ddm.Id = idCounter; ddm.project = item; ddlistItems.Add(ddm); idCounter++; } var selectedProject = ddlistItems.FirstOrDefault(x => x.Id == id); var model = new ProjectOverviewViewModel() { projects = ddlistItems, SelectedProject = selectedProject }; return(View(model)); }
public DropdownModel GetMothersHelpersType() { using (var client = new System.Net.Http.HttpClient()) { var env = ConfigurationManager.AppSettings["Enviroment"]; var settings = ""; var uri = new Uri("http://api.jataka.fun/api/MothersHelpers/getMothersHelpersType/"); if (env == "Dev") { settings = ConfigurationManager.AppSettings["LocalWebApi"]; uri = new Uri("http://localhost:5187/api/MothersHelpers/getMothersHelpersType/"); } else { settings = ConfigurationManager.AppSettings["ProductionWebApi"]; uri = new Uri("http://api.jataka.fun/api/MothersHelpers/getMothersHelpersType/"); } //var uri = new Uri(settings + "api/MothersHelpers/getMothersHelpersType/"); var response = client.GetAsync(uri).Result; var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var x = JObject.Parse(responseString); XNode node = JsonConvert.DeserializeXNode(x.ToString(), "data"); string a = node.ToString(); string trima = a.Replace("\r\n", ""); trima = a.Replace("{", ""); trima = a.Replace("}", ""); DropdownModel model = new DropdownModel(); //Model.items.Add(new SelectListItem { Text = "Please Select ", Value = "0" }); XDocument xml = XDocument.Parse(trima); foreach (var el in xml.Descendants("mothersHelpersTypeLists")) { string ID = el.Element("ID").Value; string AnimalType = el.Element("Name").Value; model.items.Add(new SelectListItem { Text = AnimalType, Value = ID }); } var animalType = ""; foreach (SelectListItem s in model.items) { if (s.Value == animalType) { s.Selected = true; } } return(model); //ViewData["animalTypeData"] = model.items; } }
public static void Dropdown(DropdownModel table) { string Delete = SqliteQuery.Delete("Dropdown", table.ID); SqliteDataAccess.ExecuteQuery(Delete, table); }
public ActionResult Slideshow() { var Mode = ""; try { Mode = Session["Mode"] as string; string mode = ""; Session["Mode"] = mode; } catch (Exception ex) { Mode = ""; } try { DropdownModel model = new DropdownModel(); GetLookups myGetLookups1 = new GetLookups(); model = myGetLookups1.GetCategory(); ViewData["CategoryData"] = model.items; //response myresoonse = new response(); //GetPartOfAlbum myGetPartOfAlbum = new GetPartOfAlbum(); //myresoonse = myGetPartOfAlbum.GetAll(1); response items1 = new response(); GetPartOfAlbum myGetLookups = new GetPartOfAlbum(); if (Mode == "") { items1 = myGetLookups.GetAll(1, 0); for (int i = 0; i < model.items.Count(); i++) { //modelDish.items[i].Value if (model.items[i].Value == "1") { model.items[i].Selected = true; } } ViewData["Title"] = 0; } else { string contentAll = Session["modeCategory"] as string; int iContent = Convert.ToInt16(contentAll); string themeAll = Session["modeTheme"] as string; int iTheme = Convert.ToInt16(themeAll); items1 = myGetLookups.GetAll(iContent, iTheme); //LogEntry("Slideshow modeCategory" + iContent); for (int i = 0; i < model.items.Count(); i++) { //modelDish.items[i].Value if (model.items[i].Value == contentAll) { model.items[i].Selected = true; } } } CategoryListall MyFavoritesModel = new CategoryListall(); //var x = items1.data[0]; MyFavoritesModel = items1.data[0] as CategoryListall; List <CategoryListall> myList = new List <CategoryListall>(); CategoryListall list = new CategoryListall(); // LogEntry("We found "+ MyFavoritesModel.categoryListsall.Count);//replace with something like Serilog for (int i = 0; i < MyFavoritesModel.categoryListsall.Count; i++) { categoryall myanimalType = new categoryall(); myanimalType.RECEIPTNO = MyFavoritesModel.categoryListsall[i].RECEIPTNO; myanimalType.Title = MyFavoritesModel.categoryListsall[i].Title; myanimalType.Comments = MyFavoritesModel.categoryListsall[i].Comments; myanimalType.Picture = MyFavoritesModel.categoryListsall[i].Picture; myanimalType.url = MyFavoritesModel.categoryListsall[i].url; list.categoryListsall.Add(myanimalType); } ViewData["MyFavortiesData"] = list; //LogEntry("calling view"); } catch (Exception ex) { LogEntry(ex.ToString());//replace with something like Serilog throw; } DropdownModel modelContent = new DropdownModel(); //modelDay.items.Add(new SelectListItem { Text = "Please Select", Value = "0" }); string[] content = { "PDF", "Audio" }; string content1 = ""; for (int i = 0; i < content.Length; i++) { modelContent.items.Add(new SelectListItem { Text = content[i], Value = content[i] }); } //try //{ // content1 = Session["contentAll"] as string; // LogEntry("contentAll !!!!"+content1); //} //catch (Exception ex) //{ // content1 = ""; //} //for (int i = 0; i < modelContent.items.Count(); i++) //{ // //modelDish.items[i].Value // string check = modelContent.items[i].Text; // if (check == content1) // { // modelContent.items[i].Selected = true; // LogEntry("Found !!!!"); // } //} //ViewData["contentAll"] = modelContent.items; GetLookups myGetTheme = new GetLookups(); DropdownModel modelTheme = new DropdownModel(); modelTheme = myGetTheme.GetTheme(); string modeTheme = ""; try { modeTheme = Session["modeTheme"] as string; } catch (Exception ex) { modeTheme = ""; } for (int i = 0; i < modelTheme.items.Count(); i++) { //modelDish.items[i].Value if (modelTheme.items[i].Value == modeTheme) { modelTheme.items[i].Selected = true; } } ViewData["themeData"] = modelTheme.items; return(View()); }
public ActionResult PdfResultsView(string all) { using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream()) { Document document = new Document(PageSize.A4, 10, 10, 10, 10); PdfWriter writer = PdfWriter.GetInstance(document, memoryStream); document.Open(); Story modelStory = new Story(); DropdownModel model = new DropdownModel(); //Create a single column table var t = new PdfPTable(1); //Tell it to fill the page horizontally t.WidthPercentage = 100; //Create a single cell var c = new PdfPCell(); //Tell the cell to vertically align in the middle c.VerticalAlignment = Element.ALIGN_MIDDLE; //Tell the cell to fill the page vertically c.MinimumHeight = document.PageSize.Height - (document.BottomMargin + document.TopMargin); //Create a test paragraph //var p = new Paragraph(" EBook Custom Favorite Recipes from whatscookingtreasures.com"); //Add it a couple of times //c.AddElement(p); var imagePath1 = Server.MapPath("~/content/album.jpg"); iTextSharp.text.Image pic1 = iTextSharp.text.Image.GetInstance(imagePath1); //pic1.BorderWidth = 0; pic1.BorderColor = Color.WHITE; c.AddElement(pic1); //Add the cell to the paragraph t.AddCell(c); //Add the table to the document document.Add(t); document.NewPage(); string[] rowschosen = all.Split('|'); int length = rowschosen.Length; for (int i = 0; i < length; i++) { var jatakaID = Convert.ToInt16(rowschosen[i]); GetLookups myGetLookups = new GetLookups(); modelStory = myGetLookups.GetSpecificStory(jatakaID); var Stories = modelStory.Stories; Paragraph para = new Paragraph(Stories); para.Font = FontFactory.GetFont(FontFactory.HELVETICA, 14f); document.Add(para); if (i != length - 1) { document.NewPage(); } } document.Close(); byte[] bytes = memoryStream.ToArray(); memoryStream.Close(); Response.Clear(); Response.ContentType = "application/pdf"; string pdfName = "User"; Response.AddHeader("Content-Disposition", "attachment; filename=" + pdfName + ".pdf"); Response.ContentType = "application/pdf"; Response.Buffer = true; Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); Response.BinaryWrite(bytes); Response.End(); Response.Close(); } //using (MemoryStream ms = new MemoryStream()) //using (Document document = new Document(PageSize.A4, 25, 25, 30, 30)) //using (PdfWriter writer = PdfWriter.GetInstance(document, ms)) //{ // document.Open(); // document.NewPage(); // //Create a single column table // var t = new PdfPTable(1); // //Tell it to fill the page horizontally // t.WidthPercentage = 100; // //Create a single cell // var c = new PdfPCell(); // //Tell the cell to vertically align in the middle // c.VerticalAlignment = Element.ALIGN_MIDDLE; // //Tell the cell to fill the page vertically // c.MinimumHeight = document.PageSize.Height - (document.BottomMargin + document.TopMargin); // //Create a test paragraph // //var p = new Paragraph(" EBook Custom Favorite Recipes from whatscookingtreasures.com"); // //Add it a couple of times // //c.AddElement(p); // var imagePath1 = Server.MapPath("~/images/worldmap3.jpg"); // iTextSharp.text.Image pic1 = iTextSharp.text.Image.GetInstance(imagePath1); // c.AddElement(pic1); // //Add the cell to the paragraph // t.AddCell(c); // //Add the table to the document // document.Add(t); // var rows = all; // rows = all.Trim(); // if (rows.EndsWith("|")) // { // rows = rows.Remove(rows.Length - 1, 1); // } // //ViewData["all"] = rows; // Story modelStory = new Story(); // DropdownModel model = new DropdownModel(); // string[] rowschosen = rows.Split('|'); // int length = rowschosen.Length; // for (int i = 0; i < length; i++) // { // var jatakaID = Convert.ToInt16(rowschosen[i]); // GetLookups myGetLookups = new GetLookups(); // modelStory = myGetLookups.GetSpecificStory(jatakaID); // var Stories = modelStory.Stories; // document.NewPage(); // //define a bold font to be used // Font boldFont = FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 12); // var phrase = new Phrase(); // phrase.Add(new Chunk(s.Title, boldFont)); // Paragraph paragraph1 = new Paragraph(); // paragraph1.Add(phrase); // document.Add(paragraph1); // PdfPTable table = new PdfPTable(2); // table.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER; // Paragraph paragraphBreak = new Paragraph(); // paragraphBreak.Add(" "); // document.Add(paragraphBreak); // //document.Add(paragraphBreak); // string comments = Stories; // //comments = HttpUtility.HtmlDecode(comments); // if (comments.Length > 0) // { // StringWriter myWriter = new StringWriter(); // // Decode the encoded string. // HttpUtility.HtmlDecode(comments, myWriter); // comments = myWriter.ToString(); // MemoryStream memStream = new MemoryStream(); // TextReader xmlString = new StringReader(comments); // byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(comments); // MemoryStream msComments = new MemoryStream(byteArray); // XMLWorkerHelper.GetInstance().ParseXHtml(writer, document, msComments, System.Text.Encoding.UTF8); // } // document.Add(paragraphBreak); // //document.Add(paragraphBreak); // document.Add(table); // //document.Add(new Paragraph(IngredHTML)); // } // } // document.Close(); // writer.Close(); // ms.Close(); // Response.ContentType = "pdf/application"; // Response.AddHeader("content-disposition", "attachment;filename=whatscookingtreasures_PDF_document.pdf"); // Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length); //} //return View("PdfResultsView"); return(View()); }
/// <summary> /// Add or Edit Question for Document /// </summary> /// <param name="prm"></param> /// <returns></returns> public ActionResult SaveQuestion(string prm) { int DocumentId, DocumentQuestionId, StepID; ViewQuestionModel objViewQuestionModel = new ViewQuestionModel(); QuestionDetailModel objQuestionDetailModel = new QuestionDetailModel(); try { if (!String.IsNullOrEmpty(prm)) { string strPrm = CommonUtils.Decrypt(prm); //If strPrm contain , means question is in edit mode else question is in add mode. if (strPrm.Contains(",") && strPrm.Split(',').Length > 2) { int.TryParse(strPrm.Split(',')[0], out DocumentId); int.TryParse(strPrm.Split(',')[1], out DocumentQuestionId); int.TryParse(strPrm.Split(',')[2], out StepID); } else if (strPrm.Contains(",") && strPrm.Split(',').Length > 1) { int.TryParse(strPrm.Split(',')[0], out DocumentId); int.TryParse(strPrm.Split(',')[1], out DocumentQuestionId); StepID = 0; } else { int.TryParse(strPrm, out DocumentId); //set DocumentQuestionId equal to 0 in case of Add Question. DocumentQuestionId = 0; StepID = 0; } //if Document Id is 0 means some change in parameter. then set message Document not exist and redirect to view Document page. if (DocumentId == 0) { TempData["NoticeMessage"] = "Document Not Exist"; return(RedirectToAction("ViewDocument", "Document")); } objQuestionDetailModel.DocumentID = DocumentId; objQuestionDetailModel.QuestionID = DocumentQuestionId; objQuestionDetailModel.StepID = StepID; //initial set of current page, pageSize , Total pages objViewQuestionModel.CurrentPage = 1; objViewQuestionModel.TotalPages = 0; objViewQuestionModel.QuestionDetail = objQuestionDetailModel; //Get Question Type List to fill dropdown of Question Type FillQuestionType(); if (StepID > 0) { objViewQuestionModel.PageSize = int.MaxValue - 1; //ViewBag.ParentQuestionList List <DropdownModel> objDropdown = new List <DropdownModel>(); List <DropdownModel> objParentSeSession = new List <DropdownModel>(); //Get Question in Add or Edit Model and also show Question List based on Document and sorting paging parameters serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.Question + "/GetQuestions", objViewQuestionModel); objViewQuestionModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewQuestionModel>().Result : null; foreach (QuestionDetailModel objItem in objViewQuestionModel.QuestionsList) { DropdownModel objDropdownModel = new DropdownModel(); objDropdownModel.ID = objItem.QuestionID; objDropdownModel.Value = objItem.QuestionDescription; if (objItem.QuestionType == CommonUtils.QuestionType.DropDown.ToString() || objItem.QuestionType == CommonUtils.QuestionType.SingleSelect.ToString()) { objDropdown.Add(objDropdownModel); objParentSeSession.Add(new DropdownModel { ID = objItem.QuestionID, Value = objItem.ParentDDLText }); } } Session["ParentSeSession"] = null; Session["ParentSeSession"] = objParentSeSession; ViewBag.ParentQuestionList = new SelectList(objDropdown, "Id", "Value", objViewQuestionModel.QuestionDetail.ParentQuestion); List <DropdownModel> objDropdownParent = new List <DropdownModel>(); if (Convert.ToInt32(objViewQuestionModel.QuestionDetail.ParentQuestion) > 0) { if (Session["ParentSeSession"] != null) { string OptionText = objParentSeSession.Where(x => x.ID == Convert.ToInt32(objViewQuestionModel.QuestionDetail.ParentQuestion)).FirstOrDefault().Value; StringReader theReader = new StringReader("<XmlDS>" + OptionText + "</XmlDS>"); DataSet theDataSet = new DataSet(); theDataSet.ReadXml(theReader); foreach (DataRow item in theDataSet.Tables[0].Rows) { if (item["Value"].ToString() == objViewQuestionModel.QuestionDetail.ParentAnswer.ToString()) { objViewQuestionModel.QuestionDetail.ParentAnswer = item["ID"].ToString(); } objDropdownParent.Add(new DropdownModel { ID = Convert.ToInt32(item["ID"]), Value = item["Value"].ToString() //, //Selected = item["Value"].ToString() == objViewQuestionModel.QuestionDetail.ParentAnswer.ToString() ? true : false }); } } } ViewBag.ParentAnswerList = new SelectList(objDropdownParent, "Id", "Value", objViewQuestionModel.QuestionDetail.ParentAnswer); if (objViewQuestionModel.QuestionDetail.QuestionType == CommonUtils.QuestionType.DropDown.ToString()) { DropDownValue(objViewQuestionModel.QuestionDetail.DropDownXML); } } else { objViewQuestionModel.PageSize = CommonUtils.PageSize; //Get Question in Add or Edit Model and also show Question List based on Document and sorting paging parameters serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.Question + "/GetQuestions", objViewQuestionModel); objViewQuestionModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <ViewQuestionModel>().Result : null; } objViewQuestionModel.QuestionTypeDetail = new QuestionTypeDetailModel(); //if question is in edit mode than set Question properties based on quetion type if (objViewQuestionModel != null && objViewQuestionModel.QuestionDetail != null && !String.IsNullOrEmpty(objViewQuestionModel.QuestionDetail.QuestionType)) { objViewQuestionModel.QuestionTypeDetail = objCommonUtils.SetQuestionProperties(objViewQuestionModel.QuestionDetail.QuestionType, objViewQuestionModel.QuestionPropertyList, objViewQuestionModel.QuestionTypeDetail, objViewQuestionModel.QuestionDetail.QuestionOptionsList, objViewQuestionModel.QuestionDetail.DropDownXML); } //if Success Message is not null and empty means question save successfully than set Success Message if (TempData["QuestionSucessMessage"] != null && Convert.ToString(TempData["QuestionSucessMessage"]) != "") { objViewQuestionModel.Message = Convert.ToString(TempData["QuestionSucessMessage"]); objViewQuestionModel.MessageType = CommonUtils.MessageType.Success.ToString().ToLower(); TempData["QuestionSucessMessage"] = null; } else if (objViewQuestionModel.QuestionDetail.IsPublish && objViewQuestionModel.QuestionDetail.QuestionID <= 0) { objViewQuestionModel.Message = "Can Not Edit Document"; objViewQuestionModel.MessageType = CommonUtils.MessageType.Notice.ToString().ToLower(); } StepDropDown(objViewQuestionModel.QuestionDetail.StepID, objViewQuestionModel.QuestionDetail.DocumentID); } } catch (Exception ex) { ErrorLog(ex, "Question", "SaveQuestion Get"); } return(View("SaveQuestion", objViewQuestionModel)); }
/// <summary> /// /// </summary> /// <param name="row"></param> /// <returns></returns> public ActionResult Update(int row) { Story myStory = new Story(); DropdownModel model = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); Story modelStory = new Story(); modelStory = myGetLookups.GetSpecificStory(row); var ID1 = modelStory.ID.ToString(); ViewData["id"] = ID1; var JakataID = modelStory.JakataID; var JakataIDString = modelStory.JakataID.ToString(); ViewData["JakataID"] = JakataIDString; var Comments = modelStory.Comments; var Moraltype = modelStory.MoralType; var Stories = modelStory.Stories; var StoryCategorytName = modelStory.StoryCategorytName; var Title = modelStory.Title; ViewData["comments"] = Comments; ViewData["Stories"] = Stories; ViewData["searchResults"] = row; model = myGetLookups.GeLookupSpecificStoryDropdown(); //DropdownModel model = new DropdownModel(); model = myGetLookups.GeLookupAnimal(); var AnimalType = modelStory.AnimalType; AnimalType = AnimalType.Trim(); if (AnimalType.EndsWith(",")) { AnimalType = AnimalType.Remove(AnimalType.Length - 1, 1); } string[] Animalchosen = AnimalType.Split(','); //model = new DropdownModel(); model = myGetLookups.GeLookupAnimal(); for (int i = 0; i < Animalchosen.Length; i++) { var x = Animalchosen[i]; foreach (SelectListItem s in model.items) { if (s.Value == x) { s.Selected = true; } } } ViewData["animalTypeData"] = model.items; myStory.animalCombo = model; GetLookups myYouTubeGetLookups = new GetLookups(); model = myYouTubeGetLookups.GetYouTube(JakataID); //ViewData["youTubeData"] = model.items; myStory.youTubeCombo = model; //modelAnimal = model; DropdownModel modelMoral = new DropdownModel(); //modelMoral = myGetLookups.GeLookupMoral(); model = myGetLookups.GeLookupMoral(); var moral = Moraltype.ToString(); foreach (SelectListItem s in model.items) { if (s.Value == moral) { s.Selected = true; } } ViewData["moralTypeData1"] = model.items; model = myGetLookups.GeLookupStorySource(); ViewData["storySourceData"] = model.items; model = myGetLookups.GeLookupJakataMaster(); var title = JakataID.ToString(); foreach (SelectListItem s in model.items) { if (s.Value == title) { s.Selected = true; } } ViewData["jakataMasterData"] = model.items; // titles done model = myGetLookups.GetStatus(1); ViewData["Done"] = model.items; myStory.done = model; model = myGetLookups.GetStatus(0); myStory.toDo = model; ViewData["ToDo"] = model.items; return(View(myStory)); }
//[AcceptVerbs(HttpVerbs.Post)] public ActionResult SearchResults(String searchResults, string page, int userIdPost) { Story modelStory = new Story(); Story myStory = new Story(); if (searchResults == "") { return(View(myStory)); } ViewBag.Message = "Your app description page."; //page = "0"; //if (page == "0") //{ // page = "1"; //} //else //{ // int pagenum = Convert.ToInt16(page) * 10; // page = pagenum.ToString(); //} ViewData["currentPage"] = page; var rows = searchResults; rows = searchResults.Trim(); if (rows.EndsWith("|")) { rows = rows.Remove(rows.Length - 1, 1); } ViewData["searchResults"] = rows; string[] rowschosen = rows.Split('|'); string choosen = ""; try { choosen = rowschosen[Convert.ToInt16(page) - 1]; } catch (Exception ex) { choosen = rows; } //string choosen = rowschosen[Convert.ToInt16(page)]; int total1 = rowschosen.Count(); string total = total1.ToString(); int pages = 0; try { pages = total1; ViewData["total"] = pages; } catch { ViewData["total"] = 0; } int row = Convert.ToInt16(choosen); DropdownModel model = new DropdownModel(); GetLookups myGetLookups = new GetLookups(); modelStory = myGetLookups.GetSpecificStory(row); var ID1 = modelStory.ID.ToString(); ViewData["id"] = ID1; var JakataID = modelStory.JakataID; var JakataIDString = modelStory.JakataID.ToString(); ViewData["JakataID"] = JakataIDString; var Comments = modelStory.Comments; var Moraltype = modelStory.MoralType; var Stories = modelStory.Stories; var StoryCategorytName = modelStory.StoryCategorytName; var Title = modelStory.Title; ViewData["comments"] = Comments; ViewData["Stories"] = Stories; model = myGetLookups.GeLookupSpecificStoryDropdown(); //DropdownModel model = new DropdownModel(); model = myGetLookups.GeLookupAnimal(); var AnimalType = modelStory.AnimalType; if (AnimalType != null) { AnimalType = AnimalType.Trim(); if (AnimalType.EndsWith(",")) { AnimalType = AnimalType.Remove(AnimalType.Length - 1, 1); } string[] Animalchosen = AnimalType.Split(','); //model = new DropdownModel(); model = myGetLookups.GeLookupAnimal(); for (int i = 0; i < Animalchosen.Length; i++) { var x = Animalchosen[i]; foreach (SelectListItem s in model.items) { if (s.Value == x) { s.Selected = true; } } } } ViewData["animalTypeData"] = model.items; //Story myStory = new Story(); myStory.animalCombo = model; int userID = modelStory.UserID; //modelAnimal = model; DropdownModel modelMoral = new DropdownModel(); modelMoral = myGetLookups.GeLookupMoral(); var moral = Moraltype.ToString(); foreach (SelectListItem s in modelMoral.items) { if (s.Value == moral) { s.Selected = true; } } ViewData["moralTypeData"] = modelMoral.items; model = myGetLookups.GeLookupStorySource(); ViewData["storySourceData"] = model.items; model = myGetLookups.GeLookupJakataMaster(); var title = JakataID.ToString(); foreach (SelectListItem s in model.items) { if (s.Value == title) { s.Selected = true; } } ViewData["jakataMasterData"] = model.items; // titles done model = myGetLookups.GetStatus(1); ViewData["Done"] = model.items; myStory.done = model; model = myGetLookups.GetStatus(0); myStory.toDo = model; ViewData["ToDo"] = model.items; ViewData["myStory"] = myStory; myStory.Stories = (string)ViewData["Stories"]; model = myGetLookups.GeLookupCatUsers(2); myStory.ReadersCombo = model; foreach (SelectListItem s in model.items) { if (s.Value == userID.ToString()) { s.Selected = true; modelStory.UserName = s.Text; if (s.Value == "0") { modelStory.UserName = ""; } } } ViewData["userIdPost"] = userIdPost; GetLookups myYouTubeGetLookups = new GetLookups(); model = myYouTubeGetLookups.GetYouTube(JakataID, userIdPost); myStory.youTubeCombo = model; GetStories myGetstories = new GetStories(); //modelStory.StoryCategorytNameString =myGetstories.GetStoryCategoryNameByID(StoryCategorytName); modelStory.StoryCategorytNameString = myGetLookups.GetStoryCategoryNameByID(StoryCategorytName); return(View(modelStory)); }