private void btnBuscar_Click(object sender, EventArgs e) { try { /*Conexão com o BD e buscando na tabela usuario*/ MySqlConnection CON = new MySqlConnection("SERVER=localhost;PORT=3306;User ID=root;DATABASE=gestaolocadora;PASSWORD=1234567"); CON.Open(); MySqlCommand CM = new MySqlCommand("SELECT Nome, Telefone, CPF, Email, dataCadastro FROM usuario WHERE Id_Usuario = ?", CON); CM.Parameters.Add("Id_Usuario", MySqlDbType.Int32).Value = txtID.Text; //executa o comando CM.CommandType = CommandType.Text; //recebe o conteúdo que vem do banco MySqlDataReader DR; DR = CM.ExecuteReader(); //insere as informações recebidas do banco para os componentes do form DR.Read(); txtNome.Text = DR.GetString(0); txtTelefone.Text = DR.GetString(1); txtCPF.Text = DR.GetString(2); txtEmail.Text = DR.GetString(3); dataCadastro.Text = DR.GetString(4); } catch (Exception ex) { MessageBox.Show("ID não encontrado!"); } }
private void btnBuscar_Click(object sender, EventArgs e) { try { /*Conexão com o BD e buscando na tabela filmes*/ MySqlConnection CON = new MySqlConnection("SERVER=localhost;PORT=3306;User ID=root;DATABASE=gestaolocadora;PASSWORD=1234567"); CON.Open(); MySqlCommand CM = new MySqlCommand("SELECT Titulo, Produtora, Descricao, NotaFilme, DataLancamento, Categoria, ValorFilme FROM filme WHERE Id_Filme = ?", CON); CM.Parameters.Add("Id_Filme", MySqlDbType.Int32).Value = txtIDFilme.Text; //executa o comando CM.CommandType = CommandType.Text; //recebe o conteúdo que vem do banco MySqlDataReader DR; DR = CM.ExecuteReader(); //insere as informações recebidas do banco para os componentes do form DR.Read(); txtTituloFilme.Text = DR.GetString(0); txtProdutora.Text = DR.GetString(1); txtDescricao.Text = DR.GetString(2); txtNotaFilme.Text = DR.GetString(3); txtLancamento.Text = DR.GetString(4); txtCategoria.Text = DR.GetString(5); txtValorFilme.Text = DR.GetString(6); } catch (Exception ex) { MessageBox.Show("ID não encontrado!"); } }
void parametersGrid_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { string errorString = string.Empty; bool valid = true; if (e.ColumnIndex == this.nameColumn.Index) { valid = ValidateParamaterName((string)e.FormattedValue, e, out errorString); } // void is not valid for parameters other than returnvalue if (e.ColumnIndex == this.typeColumn.Index) { if (typeof(void).ToString().Equals(e.FormattedValue) && !(this.parametersGrid.Rows[e.RowIndex].Cells[this.nameColumn.Index].Value.Equals(SR2.GetString(SR2.ReturnValueString)))) { valid = false; errorString = SR2.GetString(SR2.VoidIsNotAValidParameterType); } } if (!valid) { e.Cancel = true; DesignerHelpers.ShowMessage(this.ServiceProvider, errorString, DR.GetString(DR.WorkflowDesignerTitle), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
public static void SetInit() { SetList.Clear(); using (DB db = new DB()) { db.Open(Const.MySql_ConnStr); string sql = "select fid,gps_type,gps_id,car_number from tb_car_info where stat=1 and (gps_type=1 or gps_type=2)"; using (DR dr = db.OpenRecord(sql)) { while (dr.Read()) { SetList.Add(new SetObj() { CarID = dr.GetString(0), GPSType = dr.GetInt16(1), GPSID = dr.GetString(2), CarNumber = dr.GetString(3) }); } } } ResetEvent = new AutoResetEvent(false); }
protected override void OnSelectedIndexChanged(EventArgs e) { try { if (this.SelectedIndex < 0) { return; } object selectedItem = Items[this.SelectedIndex]; if (selectedItem == null) { return; } SelectedItemViewControl = Activator.CreateInstance(GetDetailViewType(selectedItem.GetType())) as ListItemViewControl; SelectedItemViewControl.ServiceProvider = this.serviceProvider; SelectedItemViewControl.Item = selectedItem; SelectedItemViewControl.DrawItemState = DrawItemState.Selected; SelectedItemViewControl.ItemChanged += new EventHandler(SelectedItemDetailViewControlItemChanged); SelectedItemViewControl.UpdateView(); if (Editable) { if (activeItemViewControl != null) { this.Controls.Remove(activeItemViewControl); } if (selectedItem != null) { activeItemViewControl = Activator.CreateInstance(GetItemViewType(selectedItem.GetType())) as ListItemViewControl; if (itemLocations.ContainsKey(selectedItem)) { activeItemDetailViewControl.Location = itemLocations[selectedItem]; } activeItemViewControl.DrawItemState = DrawItemState.Selected; activeItemViewControl.UpdateView(); activeItemViewControl.Item = selectedItem; this.Controls.Add(activeItemViewControl); } } } catch (Exception exception) { DesignerHelpers.ShowMessage(serviceProvider, exception.Message, DR.GetString(DR.WorkflowDesignerTitle), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); throw; } base.OnSelectedIndexChanged(e); }
protected void ddlsem_SelectedIndexChanged(object sender, EventArgs e) { SqlConnection CON; SqlCommand cmd; SqlDataReader DR; CON = new SqlConnection(ConfigurationManager.AppSettings["mss"]); CON.Open(); String str; String s = ddlstream.SelectedItem.Text; String b = ddlbr.SelectedItem.Text; String sem = ddlsem.SelectedItem.Text; //Dim mt As String = Me.DropDownList4.SelectedItem.Text str = "select * from SUBJECT where st='" + s + "' and br='" + b + "' and sem='" + sem + "'"; cmd = new SqlCommand(str, CON); DR = cmd.ExecuteReader(); if (DR.Read()) { // If mt = "Final Exam" Then if (sem == "I") { Label5.Visible = true; Label6.Visible = true; Label7.Visible = true; Label8.Visible = true; Label9.Visible = true; Label10.Visible = true; Label12.Visible = true; Label13.Visible = true; Label14.Visible = true; Label15.Visible = true; Label16.Visible = true; Txts1.Visible = true; Txts2.Visible = true; Txts3.Visible = true; Txts4.Visible = true; Txts5.Visible = true; Txts6.Visible = false; Txtp1.Visible = true; Txtp2.Visible = true; Txtp3.Visible = true; txtp4.Visible = true; txtp5.Visible = false; TXTTH.Visible = true; TXTSECTH.Visible = true; TXTPR.Visible = true; LBLPR.Visible = true; LBLSESS.Visible = true; LBLTH.Visible = true; Label5.Text = DR.GetString(3); Label6.Text = DR.GetString(4); Label7.Text = DR.GetString(5); Label8.Text = DR.GetString(6); Label9.Text = DR.GetString(7); Label10.Text = DR.GetString(8); Label12.Text = DR.GetString(9); Label13.Text = DR.GetString(10); Label14.Text = DR.GetString(11); Label15.Text = DR.GetString(12); Label16.Text = DR.GetString(13); Label19.Text = DR.GetString(3); Label20.Text = DR.GetString(4); Label21.Text = DR.GetString(5); Label22.Text = DR.GetString(6); Label23.Text = DR.GetString(7); Label26.Text = DR.GetString(8); } else if (sem == "II") { Label5.Visible = true; Label6.Visible = true; Label7.Visible = true; Label8.Visible = true; Label9.Visible = true; Label10.Visible = false; Label12.Visible = true; Label13.Visible = true; Label14.Visible = true; Label15.Visible = true; Label16.Visible = false; //TextBox2.Visible = true; //TextBox3.Visible = true; //TextBox4.Visible = true; //TextBox5.Visible = true; //TextBox6.Visible = true; //TextBox7.Visible = false; //TextBox8.Visible = true; //TextBox9.Visible = true; //TextBox10.Visible = true; //TextBox11.Visible = true; //TextBox12.Visible = false; //TXTTH.Visible = true; TXTSECTH.Visible = true; TXTPR.Visible = true; LBLPR.Visible = true; LBLSESS.Visible = true; LBLTH.Visible = true; txtm1.Visible = true; Txtm2.Visible = true; Txtm3.Visible = true; //Txtm4.Visible = true; Txtm5.Visible = true; txtm6.Visible = false; Label19.Visible = true; Label20.Visible = true; Label21.Visible = true; Label22.Visible = true; Label23.Visible = true; Label26.Visible = false; Label5.Text = DR.GetString(3); Label6.Text = DR.GetString(4); Label7.Text = DR.GetString(5); Label8.Text = DR.GetString(6); Label9.Text = DR.GetString(7); // Me.Label10.text = dr(8) Label12.Text = DR.GetString(9); Label13.Text = DR.GetString(10); Label14.Text = DR.GetString(11); Label15.Text = DR.GetString(12); Label19.Text = DR.GetString(3); Label20.Text = DR.GetString(4); Label21.Text = DR.GetString(5); Label22.Text = DR.GetString(6); Label23.Text = DR.GetString(7); //Me.Label26.Text = DR.GetString (8) //Me.Label16.text = dr.GetString (13) } else if (sem == "III") { Label5.Visible = true; Label6.Visible = true; Label7.Visible = true; Label8.Visible = true; Label9.Visible = true; Label10.Visible = false; Label12.Visible = true; Label13.Visible = true; Label14.Visible = true; Label15.Visible = true; Label16.Visible = false; Txts1.Visible = true; Txts2.Visible = true; Txts3.Visible = true; Txts4.Visible = true; Txts5.Visible = true; Txts6.Visible = false; Txtp1.Visible = true; Txtp2.Visible = true; Txtp3.Visible = true; txtp4.Visible = true; txtp5.Visible = false; TXTTH.Visible = true; TXTSECTH.Visible = true; TXTPR.Visible = true; LBLPR.Visible = true; LBLSESS.Visible = true; LBLTH.Visible = true; //TextBox13.Visible = true; //TextBox14.Visible = true; //TextBox15.Visible = true; //TextBox16.Visible = true; //TextBox17.Visible = true; //TextBox19.Visible = false; Label19.Visible = true; Label20.Visible = true; Label21.Visible = true; Label22.Visible = true; Label23.Visible = true; Label26.Visible = false; Label5.Text = DR.GetString(3); Label6.Text = DR.GetString(4); Label7.Text = DR.GetString(5); Label8.Text = DR.GetString(6); Label9.Text = DR.GetString(7); // Me.Label10.text = dr(8) Label12.Text = DR.GetString(9); Label13.Text = DR.GetString(10); Label14.Text = DR.GetString(11); Label15.Text = DR.GetString(12); Label19.Text = DR.GetString(3); Label20.Text = DR.GetString(4); Label21.Text = DR.GetString(5); Label22.Text = DR.GetString(6); Label23.Text = DR.GetString(7); //Me.Label16.text = dr(13) } else { if (sem == "IV") { Label5.Visible = true; } Label6.Visible = true; Label7.Visible = true; Label8.Visible = true; Label9.Visible = true; Label10.Visible = false; Label12.Visible = true; Label13.Visible = true; Label14.Visible = true; Label15.Visible = true; Label16.Visible = false; Txts1.Visible = true; Txts2.Visible = true; Txts3.Visible = true; Txts4.Visible = true; Txts5.Visible = true; Txts6.Visible = false; Txtp1.Visible = true; Txtp2.Visible = true; Txtp3.Visible = true; txtp4.Visible = true; txtp5.Visible = false; TXTTH.Visible = true; TXTSECTH.Visible = true; TXTPR.Visible = true; LBLPR.Visible = true; LBLSESS.Visible = true; LBLTH.Enabled = true; txtm1.Visible = true; Txtm2.Visible = true; Txtm3.Visible = true; //Txtm4.Visible = true; Txtm5.Visible = true; txtm6.Visible = false; Label19.Visible = true; Label20.Visible = true; Label21.Visible = true; Label22.Visible = true; Label23.Visible = true; Label26.Visible = false; Label5.Text = DR.GetString(3); Label6.Text = DR.GetString(4); Label7.Text = DR.GetString(5); Label8.Text = DR.GetString(6); Label9.Text = DR.GetString(7); //Me.Label10.text = dr(8) Label12.Text = DR.GetString(9); Label13.Text = DR.GetString(10); Label14.Text = DR.GetString(11); Label15.Text = DR.GetString(12); //Me.Label16.text = dr(13) Label19.Text = DR.GetString(3); Label20.Text = DR.GetString(4); Label21.Text = DR.GetString(5); Label22.Text = DR.GetString(6); Label23.Text = DR.GetString(7); } } else if (sem == "V") { Label5.Visible = true; Label6.Visible = true; Label7.Visible = true; Label8.Visible = true; Label9.Visible = true; Label10.Visible = false; Label12.Visible = true; Label13.Visible = true; Label14.Visible = true; Label15.Visible = true; Label16.Visible = false; Txts1.Visible = true; Txts2.Visible = true; Txts3.Visible = true; Txts4.Visible = true; Txts5.Visible = true; Txts6.Visible = false; Txtp1.Visible = true; Txtp2.Visible = true; Txtp3.Visible = true; txtp4.Visible = true; txtp5.Visible = false; TXTTH.Visible = true; TXTSECTH.Visible = true; TXTPR.Visible = true; LBLPR.Visible = true; LBLSESS.Visible = true; LBLTH.Visible = true; //TextBox13.Visible = true; //TextBox14.Visible = true; //TextBox15.Visible = true; //TextBox16.Visible = true; //TextBox17.Visible = true; //TextBox19.Visible = false; Label19.Visible = true; Label20.Visible = true; Label21.Visible = true; Label22.Visible = true; Label23.Visible = true; Label26.Visible = false; Label5.Text = DR.GetString(3); Label6.Text = DR.GetString(4); Label7.Text = DR.GetString(5); Label8.Text = DR.GetString(6); Label9.Text = DR.GetString(7); // Me.Label10.text = dr(8) Label12.Text = DR.GetString(9); Label13.Text = DR.GetString(10); Label14.Text = DR.GetString(11); Label15.Text = DR.GetString(12); //Label16.text = dr(13) Label19.Text = DR.GetString(3); Label20.Text = DR.GetString(4); Label21.Text = DR.GetString(5); Label22.Text = DR.GetString(6); Label23.Text = DR.GetString(7); } else if (sem == "VI") { Label5.Visible = true; Label6.Visible = true; Label7.Visible = true; Label8.Visible = true; Label9.Visible = true; Label10.Visible = true; Label12.Visible = true; Label13.Visible = true; Label14.Visible = true; Label15.Visible = true; Label16.Visible = false; Txts1.Visible = true; Txts2.Visible = true; Txts3.Visible = true; Txts4.Visible = true; Txts5.Visible = true; Txts6.Visible = false; Txtp1.Visible = true; Txtp2.Visible = true; Txtp3.Visible = true; txtp4.Visible = true; txtp5.Visible = false; TXTTH.Visible = true; TXTSECTH.Visible = true; TXTPR.Visible = true; LBLPR.Visible = true; LBLSESS.Visible = true; LBLTH.Visible = true; //TextBox13.Visible = true; //TextBox14.Visible = true; //TextBox15.Visible = true; //TextBox16.Visible = true; //TextBox17.Visible = true; //TextBox19.Visible = false; Label19.Visible = true; Label20.Visible = true; Label21.Visible = true; Label22.Visible = true; Label23.Visible = true; Label26.Visible = false; Label5.Text = DR.GetString(3); Label6.Text = DR.GetString(4); Label7.Text = DR.GetString(5); Label8.Text = DR.GetString(6); Label9.Text = DR.GetString(7); // Me.Label10.text = dr(8) Label12.Text = DR.GetString(9); Label13.Text = DR.GetString(10); Label14.Text = DR.GetString(11); Label15.Text = DR.GetString(12); //Me.Label16.text = dr(13) Label19.Text = DR.GetString(3); Label20.Text = DR.GetString(4); Label21.Text = DR.GetString(5); Label22.Text = DR.GetString(6); Label23.Text = DR.GetString(7); } else if (sem == "VII") { Label5.Visible = true; Label6.Visible = true; Label7.Visible = true; Label8.Visible = true; Label9.Visible = true; Label10.Visible = false; Label12.Visible = true; Label13.Visible = true; Label14.Visible = true; Label15.Visible = true; Label16.Visible = false; Txts1.Visible = true; Txts2.Visible = true; Txts3.Visible = true; Txts4.Visible = true; Txts5.Visible = true; Txts6.Visible = false; Txtp1.Visible = true; Txtp2.Visible = true; Txtp3.Visible = true; txtp4.Visible = true; txtp5.Visible = false; TXTTH.Visible = true; TXTSECTH.Visible = true; TXTPR.Visible = true; LBLPR.Visible = true; LBLSESS.Visible = true; LBLTH.Visible = true; //TextBox13.Visible = true; //TextBox14.Visible = true; //TextBox15.Visible = true; //TextBox16.Visible = true; //TextBox17.Visible = true; //TextBox19.Visible = false; Label19.Visible = true; Label20.Visible = true; Label21.Visible = true; Label22.Visible = true; Label23.Visible = true; Label26.Visible = false; Label5.Text = DR.GetString(3); Label6.Text = DR.GetString(4); Label7.Text = DR.GetString(5); Label8.Text = DR.GetString(6); Label9.Text = DR.GetString(7); // Me.Label10.text = dr(8) Label12.Text = DR.GetString(9); Label13.Text = DR.GetString(10); Label11.Text = DR.GetString(11); Label15.Text = DR.GetString(12); //Me.Label16.text = dr(13) Label19.Text = DR.GetString(3); Label20.Text = DR.GetString(4); Label21.Text = DR.GetString(5); Label22.Text = DR.GetString(6); Label23.Text = DR.GetString(7); } else { Label5.Visible = true; } Label6.Visible = true; Label7.Visible = true; Label8.Visible = true; Label9.Visible = false; Label10.Visible = false; Label12.Visible = true; Label13.Visible = true; Label14.Visible = true; Label15.Visible = false; Label16.Visible = false; Txts1.Visible = true; Txts2.Visible = true; Txts3.Visible = true; Txts4.Visible = true; Txts5.Visible = true; Txts6.Visible = false; Txtp1.Visible = true; Txtp2.Visible = true; Txtp3.Visible = true; txtp4.Visible = true; txtp5.Visible = false; TXTTH.Visible = true; TXTSECTH.Visible = true; TXTPR.Visible = true; LBLPR.Visible = true; LBLSESS.Visible = true; LBLTH.Visible = true; //TextBox13.Visible = true; //TextBox14.Visible = true; //TextBox15.Visible = true; //TextBox16.Visible = true; //TextBox17.Visible = false; //TextBox19.Visible = false; Label19.Visible = true; Label20.Visible = true; Label21.Visible = true; Label22.Visible = true; Label23.Visible = false; Label26.Visible = false; Label5.Text = DR.GetString(3); Label6.Text = DR.GetString(4); Label7.Text = DR.GetString(5); Label8.Text = DR.GetString(6); Label9.Text = DR.GetString(7); // Me.Label10.text = dr(8) Label12.Text = DR.GetString(9); Label13.Text = DR.GetString(10); Label14.Text = DR.GetString(11); Label15.Text = DR.GetString(12); //Me.Label16.text = dr(13) Label19.Text = DR.GetString(3); Label20.Text = DR.GetString(4); Label21.Text = DR.GetString(5); Label22.Text = DR.GetString(6); //Me.Label23.Text = DR(7) }
public static bool TryPickOperation(IServiceProvider serviceProvider, Activity activity, OperationInfoBase currentOperation, out OperationInfoBase selectedOperation) { selectedOperation = null; bool isReceiveActivity = activity is ReceiveActivity; try { using (OperationPickerDialog operationPicker = new OperationPickerDialog(serviceProvider, isReceiveActivity)) { Walker activityTreeWalker = new Walker(); Type allowedActivityType = null; if (isReceiveActivity) { allowedActivityType = typeof(ReceiveActivity); } else { allowedActivityType = typeof(SendActivity); } activityTreeWalker.FoundActivity += delegate(Walker walker, WalkerEventArgs eventArgs) { Activity foundActivity = eventArgs.CurrentActivity; if (!(allowedActivityType.IsAssignableFrom(foundActivity.GetType()))) { return; } if (!foundActivity.Enabled) { return; } if (foundActivity is ReceiveActivity) { ReceiveActivity reciveActivity = foundActivity as ReceiveActivity; if (reciveActivity.ServiceOperationInfo != null) { operationPicker.AddServiceOperation(reciveActivity.ServiceOperationInfo, reciveActivity); } } if (foundActivity is SendActivity) { SendActivity sendActivity = foundActivity as SendActivity; if (sendActivity.ServiceOperationInfo != null) { operationPicker.AddServiceOperation(sendActivity.ServiceOperationInfo, sendActivity); } } }; activityTreeWalker.Walk(activity.RootActivity); OperationInfoBase currentServiceOperationInfo = currentOperation as OperationInfoBase; if (currentServiceOperationInfo != null) { operationPicker.SelectedOperation = currentServiceOperationInfo; } DialogResult dialogResult = operationPicker.ShowDialog(); if ((operationPicker.SelectedOperation != null) && (dialogResult == DialogResult.OK) && !operationPicker.SelectedOperation.Equals(currentServiceOperationInfo)) { selectedOperation = operationPicker.SelectedOperation.Clone(); return(true); } } } catch (Exception e) { DesignerHelpers.ShowMessage(serviceProvider, e.Message, DR.GetString(DR.WorkflowDesignerTitle), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); throw; } return(false); }
bool TrySelectType(TypeBrowserDialog typeBrowserDialog, DataGridViewCell cell) { typeBrowserDialog.ShowDialog(); if (typeBrowserDialog.SelectedType != null) { if (!ParameterTypeFilterProvider.IsValidType(typeBrowserDialog.SelectedType)) { DesignerHelpers.ShowMessage(this.ServiceProvider, SR2.GetString(SR2.InvalidParameterType, typeBrowserDialog.SelectedType), DR.GetString(DR.WorkflowDesignerTitle), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return(false); } AddToTypeList(typeBrowserDialog.SelectedType); } typeChooserCellItem.ChosenType = typeBrowserDialog.SelectedType; cell.Value = typeBrowserDialog.SelectedType; return(true); }