public IEnumerable <Clothes> GetCloth(int clothId) { return(new List <Clothes> { GetDataFromDB.LoadClothesJsonData().FirstOrDefault(id => id.id == clothId) }); }
protected void Page_Load(object sender, EventArgs e) { PlaceHolder hideNavigationItems = this.Page.Master.FindControl("hideNavigationItems") as PlaceHolder; if (hideNavigationItems == null) { } else { hideNavigationItems.Visible = false; } if (Session["username"] == null) { Response.Redirect("Default.aspx"); } ArrayList values = new ArrayList(); values = GetDataFromDB.GetDataForBind("IS NOT NULL"); myCustomRepeater.DataSource = values; myCustomRepeater.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ArrayList values = new ArrayList(); values = GetDataFromDB.GetDataForBind("='dezinfekcija'"); myCustomRepeater.DataSource = values; myCustomRepeater.DataBind(); }
public IEnumerable <Manufacturer> GetManfacturer(int clothId) { var cloth = GetDataFromDB.LoadClothesJsonData().FirstOrDefault(id => id.id == clothId); var manfacturer = GetDataFromDB.LoadManfacturerJsonData().FirstOrDefault(id => id.ID == cloth?.Manfacturer?.ID); return(new List <Manufacturer> { manfacturer }); }
public Node(wsBaseItem data, int?parentID, GetDataFromDB f, Node parentNode) //,int? parent) { _parentNode = parentNode; _bi = data; bool itemType = (data == null) ? true : data.IsType; if (itemType == true) { this.GetChildList(parentID, f, this); } }
public Clothes AddCloth(Clothes clothes) { if (clothes?.id == 0) { var allClothes = GetAll(); var number = allClothes.Select(x => x.id).OrderByDescending(x => x).FirstOrDefault(); clothes.id = number + 1; } GetDataFromDB.AddClothes(clothes); return(clothes); }
private void GetChildList(int?parentID, GetDataFromDB f, Node parentNode) { List <wsBaseItem> l = new List <wsBaseItem>(); l = f(parentID); if (l.Count > 0) { foreach (wsBaseItem bi in l) { //Console.WriteLine("{0} {1} ", bi.ID, bi.Description); _chldlist.Add(new Node(bi, bi.ID, f, parentNode)); } } }
private async Task <DialogTurnResult> ActStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { if (!_luisRecognizer.IsConfigured) { // LUIS is not configured, we just run the BookingDialog path with an empty BookingDetailsInstance. return(await stepContext.BeginDialogAsync(nameof(BookingDialog), new BookingDetails(), cancellationToken)); } // Call LUIS and gather any potential booking details. (Note the TurnContext has the response to the prompt.) var luisResult = await _luisRecognizer.RecognizeAsync <FlightBooking>(stepContext.Context, cancellationToken); switch (luisResult.TopIntent().intent) { case FlightBooking.Intent.BookFlight: //await ShowWarningForUnsupportedCities(stepContext.Context, luisResult, cancellationToken); // Initialize BookingDetails with any entities we may have found in the response. var bookingDetails = new BookingDetails() { // Get destination and origin from the composite entities arrays. Destination = luisResult.ToEntities.Airport, Origin = luisResult.FromEntities.Airport, TravelDate = luisResult.TravelDate, }; // Run the BookingDialog giving it whatever details we have from the LUIS call, it will fill out the remainder. return(await stepContext.BeginDialogAsync(nameof(BookingDialog), bookingDetails, cancellationToken)); case FlightBooking.Intent.GetWeather: // We haven't implemented the GetWeatherDialog so we just display a TODO message. var getWeatherMessageText = "TODO: get weather flow here"; var getWeatherMessage = MessageFactory.Text(getWeatherMessageText, getWeatherMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(getWeatherMessage, cancellationToken); break; case FlightBooking.Intent.GetBridgeTypology: BridgeTopologyDetails topologyDetails = new BridgeTopologyDetails() { Country = luisResult.Country, Material = luisResult.Material, MaxSpan = luisResult.MaxSpan }; return(await stepContext.BeginDialogAsync(nameof(BridgeTypologyDialog), topologyDetails, cancellationToken)); //var getBridgeMessageText = "Sick dude, what kind of bridge?"; //var GgtBridgeMessageMessage = MessageFactory.Text(getBridgeMessageText, getBridgeMessageText, InputHints.IgnoringInput); //await stepContext.Context.SendActivityAsync(GgtBridgeMessageMessage, cancellationToken); case FlightBooking.Intent.GetPersonFromSkill: var skill = luisResult.Skill; var getPersonFromSkillMessageText = string.Empty; try { var foundPerson = GetDataFromDB.FindPersonWithSkill(skill.ToLower()); getPersonFromSkillMessageText = $"The people below are great at {skill}:\r\n{foundPerson}"; } catch (Exception e) { getPersonFromSkillMessageText = e.ToString(); //throw; } var getPersonFromSkillMessage = MessageFactory.Text(getPersonFromSkillMessageText, getPersonFromSkillMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(getPersonFromSkillMessage, cancellationToken); break; case FlightBooking.Intent.GetTranslation: var word = luisResult.Word; var language = luisResult.Language; var translatedWord = GetDataFromDB.FindWord(word.ToLower(), language); var getTranslatedWordMessageText = $"The {language} word for {word} is {translatedWord}"; var getTranslatedWordMessage = MessageFactory.Text(getTranslatedWordMessageText, getTranslatedWordMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(getTranslatedWordMessage, cancellationToken); break; case FlightBooking.Intent.GetProjectFromTypology: string getProjectFromTypoMessageText = string.Empty; try { var typologi = luisResult.Typology; if (typologi != null) { var matchedProjects = GetDataFromDB.FindProjcetByTypology(typologi.ToLower()); getProjectFromTypoMessageText = $"The projects below are using the same typology as {typologi}:\r\n{matchedProjects}"; } else { getProjectFromTypoMessageText = "Try again."; } } catch (Exception e) { getProjectFromTypoMessageText = e.ToString(); //throw ; } var getProjectFromTypoMessage = MessageFactory.Text(getProjectFromTypoMessageText, getProjectFromTypoMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(getProjectFromTypoMessage, cancellationToken); break; case FlightBooking.Intent.GetPersonFromProject: var project = luisResult.Project; var people = "bunch of people"; var getPersonFromProjectMessageText = $"{project} is great at {people}"; var getPersonFromProjectMessage = MessageFactory.Text(getPersonFromProjectMessageText, getPersonFromProjectMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(getPersonFromProjectMessage, cancellationToken); break; case FlightBooking.Intent.ShowProject: var projectModel = luisResult.Project; string url = StreamProject.GetProjectUrl(projectModel); string response = string.Empty; if (url == null) { response = $"sorry couldn't find that model."; } else { response = $"A 3d view of the model '{projectModel}' can be found here: "; response += url; } var msgMessage1 = MessageFactory.Text(response, response, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(msgMessage1, cancellationToken); break; case FlightBooking.Intent.GenerateParametricBuilding: var curviness = luisResult.Curviness; var levels = luisResult.Levels; StreamProject.StreamBuilding(levels, curviness); string msg = $"I have generated a building with {levels} levels. Please see the link here: "; msg += "http://bot.continuum.codes/viewer.html"; var msgMessage = MessageFactory.Text(msg, msg, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(msgMessage, cancellationToken); break; case FlightBooking.Intent.WhatsNext: var whatsnext = "Thank you! I will continue to learn from all of you. Your quesions will help me grow my knowledge such that I can better support you in the future. A first step is to run micro - applications to help you solve your problems and, as my database grows, I will be able to suggest solutions to increasingly complex technical problems."; //var matchedProjects = GetDataFromDB.FindProjcetByTypology(typologi.ToLower()); //var getProjectFromTypoMessageText = $"The projects below are using the same typology as {typologi}:\r\n{matchedProjects}"; var whatsnextMsg = MessageFactory.Text(whatsnext, whatsnext, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(whatsnextMsg, cancellationToken); break; default: var act = stepContext?.Context?.Activity?.Text; if (_askCounter > 0 && act != "Hello") { return(await stepContext.BeginDialogAsync(nameof(CreatePostDialog), null, cancellationToken)); } break; // Catch all for unhandled intents //var didntUnderstandMessageText = $"Sorry, I didn't get that. Please try asking in a different way (intent was {luisResult.TopIntent().intent})"; //var didntUnderstandMessage = MessageFactory.Text(didntUnderstandMessageText, didntUnderstandMessageText, InputHints.IgnoringInput); // await stepContext.Context.SendActivityAsync(didntUnderstandMessage, cancellationToken); //break; } _askCounter++; return(await stepContext.NextAsync(null, cancellationToken)); }
private void GetChildList(int? parentID, GetDataFromDB f, Node parentNode) { List<wsBaseItem> l = new List<wsBaseItem>(); l = f(parentID); if (l.Count > 0) { foreach (wsBaseItem bi in l) { //Console.WriteLine("{0} {1} ", bi.ID, bi.Description); _chldlist.Add(new Node(bi, bi.ID, f, parentNode)); } } }
public Node(wsBaseItem data, int? parentID, GetDataFromDB f, Node parentNode)//,int? parent) { _parentNode = parentNode; _bi = data; bool itemType = (data == null) ? true : data.IsType; if (itemType == true) this.GetChildList(parentID, f, this); }
public Node(GetDataFromDB f) : this(null, null, f, null) { }
private void button2_Click(object sender, EventArgs e) { try { JArray dataArray = GetDataFromDB.ReadCsvFile(textBox1.Text); //extract all data property name. JToken exampleToken = dataArray[0]; String[] keys = new String[dataArray[0].Count()]; List <String[]> values = new List <String[]>(); int count = 0; //save this relation PropertyNameToIndex = new Dictionary <string, int>(); //add head name to grid and propertyBox foreach (JProperty property in exampleToken) { keys[count] = property.Name; this.propertyBox.Items.Add(property.Name); PropertyNameToIndex.Add(property.Name, count); count++; } // Set how many kinds of data should be show DataGrid.ColumnCount = dataArray[0].Count(); DataGrid.ColumnHeadersVisible = true; // Set the column header style. DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle(); columnHeaderStyle.BackColor = Color.Beige; columnHeaderStyle.Font = new Font("Verdana", 10, FontStyle.Bold); DataGrid.ColumnHeadersDefaultCellStyle = columnHeaderStyle; //set the row style DataGridViewCellStyle rowStyle = new DataGridViewCellStyle(); //DataGrid.RowsDefaultCellStyle; //set row's data style by this //this.DataGrid.Rows[0].Cells[0].Style; //a example that changes the forecolor of the first row's second column //this.DataGrid.Rows[0].Cells[1].Style.ForeColor = Color.Red; // Set the column header names. for (int i = 0; i < DataGrid.ColumnCount; i++) { DataGrid.Columns[i].Name = keys[i]; } // Populate the rows. foreach (JToken jToken in dataArray) { String[] aValues = new String[dataArray[0].Count()]; int j = 0; foreach (JProperty property in jToken) { if (Validate(property)) { aValues[j] = property.Value.ToString(); } else { aValues[j] = invalidePrompt; } j++; } values.Add(aValues); DataGrid.Rows.Add(aValues); } //add items into checkedListBoxs //Clear all existing item in check box this.fieldBox.Items.Clear(); this.chart1.Series.Clear(); //add item to field box that would contain all field number for (int i = 1; i <= dataArray.Count; i++) { this.fieldBox.Items.Add("field " + i.ToString()); } //add item to property box that would contains all proerty name } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private async Task <DialogTurnResult> ActStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { if (!_luisRecognizer.IsConfigured) { // LUIS is not configured, we just run the BookingDialog path with an empty BookingDetailsInstance. return(await stepContext.BeginDialogAsync(nameof(BookingDialog), new BookingDetails(), cancellationToken)); } // Call LUIS and gather any potential booking details. (Note the TurnContext has the response to the prompt.) var luisResult = await _luisRecognizer.RecognizeAsync <FlightBooking>(stepContext.Context, cancellationToken); switch (luisResult.TopIntent().intent) { case FlightBooking.Intent.BookFlight: await ShowWarningForUnsupportedCities(stepContext.Context, luisResult, cancellationToken); // Initialize BookingDetails with any entities we may have found in the response. var bookingDetails = new BookingDetails() { // Get destination and origin from the composite entities arrays. Destination = luisResult.ToEntities.Airport, Origin = luisResult.FromEntities.Airport, TravelDate = luisResult.TravelDate, }; // Run the BookingDialog giving it whatever details we have from the LUIS call, it will fill out the remainder. return(await stepContext.BeginDialogAsync(nameof(BookingDialog), bookingDetails, cancellationToken)); case FlightBooking.Intent.GetWeather: // We haven't implemented the GetWeatherDialog so we just display a TODO message. var getWeatherMessageText = "TODO: get weather flow here"; var getWeatherMessage = MessageFactory.Text(getWeatherMessageText, getWeatherMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(getWeatherMessage, cancellationToken); break; case FlightBooking.Intent.GetBridgeTypology: BridgeTopologyDetails topologyDetails = new BridgeTopologyDetails() { Country = luisResult.Country }; return(await stepContext.BeginDialogAsync(nameof(BridgeTypologyDialog), topologyDetails, cancellationToken)); //var getBridgeMessageText = "Sick dude, what kind of bridge?"; //var GgtBridgeMessageMessage = MessageFactory.Text(getBridgeMessageText, getBridgeMessageText, InputHints.IgnoringInput); //await stepContext.Context.SendActivityAsync(GgtBridgeMessageMessage, cancellationToken); case FlightBooking.Intent.GetPersonFromSkill: var skill = luisResult.Skill; var foundPerson = GetDataFromDB.FindPersonWithSkill(skill.ToLower()); var getPersonFromSkillMessageText = $"The people below are great at {skill}:\r\n{foundPerson}"; var getPersonFromSkillMessage = MessageFactory.Text(getPersonFromSkillMessageText, getPersonFromSkillMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(getPersonFromSkillMessage, cancellationToken); break; case FlightBooking.Intent.GetPersonFromProject: var project = luisResult.Project; var people = "bunch of people"; var getPersonFromProjectMessageText = $"{project} is great at {people}"; var getPersonFromProjectMessage = MessageFactory.Text(getPersonFromProjectMessageText, getPersonFromProjectMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(getPersonFromProjectMessage, cancellationToken); break; case FlightBooking.Intent.ShowProject: var projectModel = luisResult.Project; StreamProject.Stream(projectModel); break; default: // Catch all for unhandled intents var didntUnderstandMessageText = $"Sorry, I didn't get that. Please try asking in a different way (intent was {luisResult.TopIntent().intent})"; var didntUnderstandMessage = MessageFactory.Text(didntUnderstandMessageText, didntUnderstandMessageText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(didntUnderstandMessage, cancellationToken); break; } return(await stepContext.NextAsync(null, cancellationToken)); }
public IEnumerable <Manufacturer> GetManfacturers() { var data = GetDataFromDB.LoadManfacturerJsonData(); return(data); }
public IEnumerable <Clothes> GetAll() { return(GetDataFromDB.LoadClothesJsonData()); }