private void GetDropContaCorrente() { CONTACORRENTEProvider CONTACORRENTEP = new CONTACORRENTEProvider(); CONTACORRENTECollection CONTACORRENTEColl = new CONTACORRENTECollection(); CONTACORRENTEColl = CONTACORRENTEP.ReadCollectionByParameter(null, "NOMECONTA"); cbContaCorrente.DisplayMember = "NOMECONTA"; cbContaCorrente.ValueMember = "IDCONTACORRENTE"; CONTACORRENTEEntity CONTACORRENTETy = new CONTACORRENTEEntity(); CONTACORRENTETy.NOMECONTA = ConfigMessage.Default.MsgDrop; CONTACORRENTETy.IDCONTACORRENTE = -1; CONTACORRENTEColl.Add(CONTACORRENTETy); Phydeaux.Utilities.DynamicComparer <CONTACORRENTEEntity> comparer = new Phydeaux.Utilities.DynamicComparer <CONTACORRENTEEntity>(cbContaCorrente.DisplayMember); CONTACORRENTEColl.Sort(comparer.Comparer); cbContaCorrente.DataSource = CONTACORRENTEColl; cbContaCorrente.SelectedIndex = 0; }
private void SalvaSaldo() { try { CONTACORRENTEProvider CONTACORRENTEP = new CONTACORRENTEProvider(); CONTACORRENTEEntity CONTACORRENTETy = new CONTACORRENTEEntity(); CONTACORRENTETy = CONTACORRENTEP.Read(Convert.ToInt32(cbContaCorrente.SelectedValue)); //decimal VALOR = Convert.ToInt32(cbCrediDebito.SelectedValue) == 2 ? (Convert.ToDecimal(txtValor.Text) * -1) : Convert.ToDecimal(txtValor.Text); //if (Tipo == 0) //0 Soma // 1 Subtrai // CONTACORRENTETy.SALDO = CONTACORRENTETy.SALDO + Convert.ToDecimal(VALOR); //else if (Tipo == 1) // CONTACORRENTETy.SALDO = CONTACORRENTETy.SALDO - Convert.ToDecimal(VALOR); CONTACORRENTETy.SALDO = SaldoExtrato(); CONTACORRENTEP.Save(CONTACORRENTETy); } catch (Exception ex) { MessageBox.Show("Erro técnico: " + ex.Message); } }