示例#1
0
        public override int GetHashCode()
        {
            int hashCode = 1278947931;

            hashCode = hashCode * -1521134295 + DataVenda.GetHashCode();
            hashCode = hashCode * -1521134295 + CPF_CNPJ.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <List <long> > .Default.GetHashCode(IdNF);

            return(hashCode);
        }
示例#2
0
        public int Save()
        {
            int             rows = 0;
            MySqlConnection conn = Connection.GetInstance().GetConnection();
            MySqlCommand    cmd  = conn.CreateCommand();

            try
            {
                if (IsNew)
                {
                    cmd.CommandText = "INSERT INTO tb_vendas VALUES (@cod, @desc, @cliente, @vendido_por, @tipo, @total, @parcelas, @vendido, @orcamento)";
                }
                else
                {
                    cmd.CommandText = "UPDATE tb_vendas SET desconto=@desc, cliente=@cliente, vendido_por=@vendido_por, tipo=@tipo, total=@total, parcelas=@parcelas, data_venda=@vendido, data_orcamento=@orcamento WHERE cod = @cod";
                }
                cmd.Parameters.AddWithValue("@cod", Cod);
                cmd.Parameters.AddWithValue("@desc", Desconto);
                cmd.Parameters.AddWithValue("@cliente", Cliente.Id);
                cmd.Parameters.AddWithValue("@vendido_por", User.Id);
                cmd.Parameters.AddWithValue("@tipo", Tipo);
                cmd.Parameters.AddWithValue("@total", Total);
                cmd.Parameters.AddWithValue("@parcelas", Parcelas);
                cmd.Parameters.AddWithValue("@vendido", DataVenda.ToString("yyyy-MM-dd H:mm:ss"));
                cmd.Parameters.AddWithValue("@orcamento", DataOrcamento.ToString("yyyy-MM-dd"));
                rows = cmd.ExecuteNonQuery();
                if (!IsNew)
                {
                    DeleteItens();
                }
                rows = InsertItens();
            } catch (Exception erro) {
                Messages.ShowError("Erro: " + erro.Message);
                rows = -1;
            } finally {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(rows);
        }
示例#3
0
 public override string ToString()
 {
     return(string.Concat(this.CasaVendavel.Localidade + "(" + CasaVendavel.IdCasa + ")" + " a " + DataVenda.ToShortDateString()));
 }
示例#4
0
 public string DataFormated()
 {
     return(DataVenda.ToString("dd/MM/yyyy HH:mm", new CultureInfo("pt-BR")));
 }