コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Entity.Bill bill = new Entity.Bill();
            bill.id_bill           = Convert.ToInt32(txtNoBill.Text);
            bill.totalPrice        = float.Parse(lblPrice.Text);
            bill.client.idDBClient = Convert.ToInt32(lblIDUser.Text);

            bill_Logic.InsertHomeDelivery(bill);
            MessageBox.Show("Factura Registrada");
        }
コード例 #2
0
        public List <Entity.Bill> searchBill(int status, string date1 = null, string date2 = null)
        {
            List <Entity.Bill> lst = new List <Entity.Bill>();

            String sql = "";

            if (status == 0)
            {
                sql = "select* from viewtblBill where sTrangthai = 1";
            }
            else if (status == 2)
            {
                sql = "select* from viewtblBill where sTrangthai = 1 and DAY(GETDATE()) = DAY(dThoigianthanhtoan) and MONTH(GETDATE()) = MONTH(dThoigianthanhtoan)" +
                      "and YEAR(GETDATE()) = YEAR(dThoigianthanhtoan)";
            }
            else if (status == 1)
            {
                sql = "select * from viewtblBill where dThoigianthanhtoan between '" + date1 + "' and '" + date2 + "'";
            }
            Debug.WriteLine(sql);
            DataTable dt = conn.getTable(sql);

            foreach (DataRow item in dt.Rows)
            {
                Entity.Bill x = new Entity.Bill(
                    item["iId"].ToString(),
                    item["sName"].ToString(),
                    item["sHoten"].ToString(),
                    item["dThoigianthanhtoan"].ToString(),
                    item["sTrangthai"].ToString(),
                    item["fToongtien"].ToString()
                    );
                lst.Add(x);
            }
            return(lst);
        }