コード例 #1
0
        private void btnKetXuat_Click(object sender, EventArgs e)
        {
            if (txtTongTien.Text == "" || txtTienKhachDua.Text == "")
            {
                MessageBox.Show("Thông tin tổng tiền hoặc tiền khách đưa lỗi!");
                return;
            }
            float tongtien     = float.Parse(txtTongTien.Text);
            float tienkhachdua = float.Parse(txtTienKhachDua.Text);
            float tienthua     = tongtien - tienkhachdua;

            txtTienThua.Text = tienthua.ToString();
            //them vao bao cao thu
            DateTime      t         = DateTime.Now.Date;
            Baocaothu_DTO bc        = new Baocaothu_DTO(t, "Hoa don", float.Parse(txtTongTien.Text));
            Baocaothu_BUS baocaothu = new Baocaothu_BUS();

            baocaothu.ThemBaoCao(bc);
        }
コード例 #2
0
        public bool ThemBaoCao(Baocaothu_DTO bc)
        {
            SqlConnection conn1 = ConnectToSQL.HamKetNoi();
            string        str1  = "INSERT INTO BAOCAOTHU(Ngay, Loai, Tien) VALUES (@Ngay, @Loai, @Tien)";
            SqlCommand    cmd1  = new SqlCommand(str1, conn1);

            cmd1.CommandType = CommandType.Text;

            cmd1.Parameters.Add("@Ngay", SqlDbType.DateTime);
            cmd1.Parameters.Add("@Loai", SqlDbType.NVarChar, 50);
            cmd1.Parameters.Add("@Tien", SqlDbType.Float);

            cmd1.Parameters["@Ngay"].Value = bc.Ngay;
            cmd1.Parameters["@Loai"].Value = bc.Loai;
            cmd1.Parameters["@Tien"].Value = bc.Tien;

            conn1.Open();
            cmd1.ExecuteNonQuery();
            conn1.Close();
            return(true);
        }
コード例 #3
0
        public bool ThemBaoCao(Baocaothu_DTO bc)
        {
            Baocaothu_DAO t = new Baocaothu_DAO();

            return(t.ThemBaoCao(bc));
        }