//this is for updating private void btnEdit_Click(object sender, EventArgs e) { try { if (dgvState.RowCount != 0) { StateDialog dlgState = new StateDialog(); dlgState.CountryName = (dgvState.SelectedRows[0].Cells[2].Value).ToString(); dlgState.stateName = (dgvState.SelectedRows[0].Cells[3].Value).ToString(); dlgState.IsActive = (bool)(dgvState.SelectedRows[0].Cells[4].Value); int stateId = (int)(dgvState.SelectedRows[0].Cells[0].Value); StateBO objStateBO = new StateBO(); StateData objStateData = new StateData(); if (dlgState.ShowDialog() == DialogResult.OK) { objStateData.StateId = stateId; objStateData.FKCountryId = dlgState.countryId; objStateData.StateName = dlgState.stateName; objStateData.IsActive = dlgState.IsActive; objStateBO.UpdateInState(objStateData); } } } catch { MessageBox.Show("error at edit form"); } dgvState.DataSource = StateBO.GetStates(); }
private void btnUpdate_Click(object sender, EventArgs e) { state = new State(); StateDialog dialog = new StateDialog(); state.PKStateId = Convert.ToInt32(dgvState.SelectedRows[0].Cells[0].Value); dialog.CountryId = Convert.ToInt32(dgvState.SelectedRows[0].Cells[1].Value); //dialog.CountryName = dgvState.SelectedRows[0].Cells[2].Value.ToString();//for seeing which works . dialog.StateName = dgvState.SelectedRows[0].Cells[3].Value.ToString(); dialog.IsActive = (bool)(dgvState.SelectedRows[0].Cells[4].Value); if (dialog.ShowDialog() == DialogResult.OK) { try { state.FKCountryId = dialog.CountryId; state.StateName = dialog.StateName; state.IsActive = dialog.IsActive; Interaction.Update(state, 2); } catch (Exception) { MessageBox.Show("you are in the table state in update"); } } dgvState.DataSource = Interaction.Getdetails(2); }
public async Task ShouldCheckCurrentCity() { IDialog <object> stateDialog = new StateDialog(); var toBot = DialogTestBase.MakeTestMessage(); toBot.From.Id = Guid.NewGuid().ToString(); toBot.Text = "hi"; Func <IDialog <object> > MakeRoot = () => stateDialog; using (new FiberTestBase.ResolveMoqAssembly(stateDialog)) using (var container = Build(Options.MockConnectorFactory | Options.ScopedQueue, stateDialog)) { // act: sending the message IMessageActivity toUser = await GetResponse(container, MakeRoot, toBot); // assert: check if the dialog returned the right response Assert.IsTrue(toUser.Text.Equals("Welcome to the Search City bot. I'm currently configured to search for things in Seattle")); toBot.Text = "Thiago"; toUser = await GetResponse(container, MakeRoot, toBot); Assert.IsTrue(toUser.Text.StartsWith("Welcome Thiago!")); toBot.Text = "current city"; toUser = await GetResponse(container, MakeRoot, toBot); Assert.IsTrue(toUser.Text.Equals("Hey Thiago, I'm currently configured to search for things in Seattle.")); } }
private void btnAdd_Click(object sender, EventArgs e) { try { StateDialog dlgState = new StateDialog(); if (dlgState.ShowDialog() == DialogResult.OK) { StateBO objstateBO = new StateBO(); objstateBO.InsertInState(dlgState.countryId, dlgState.stateName, dlgState.IsActive); dgvState.DataSource = StateBO.GetStates(); } } catch { MessageBox.Show("Error in state form"); } }
private void btnAdd_Click(object sender, EventArgs e) { state = new State(); StateDialog dialog = new StateDialog(); if (dialog.ShowDialog() == DialogResult.OK) { try { state.FKCountryId = dialog.CountryId; state.StateName = dialog.StateName; state.IsActive = dialog.IsActive; Interaction.AddData(state, 2); } catch (Exception) { MessageBox.Show("you are in the stateform Add"); } } dgvState.DataSource = Interaction.Getdetails(2); }