private void fReport_Load(object sender, EventArgs e)
        {
            String sql = "";
            if(status == null)
            {
                sql = "select * from dbo.viewRepostBill where bill_id = " + bill;
                CrystalReport1 crystalReport = new CrystalReport1();
                crystalReport.SetDataSource(conn.getTable(sql));
                crystalReportViewer1.ReportSource = crystalReport;
            }
            else
            {
                if(status == "0")
                {
                    sql = "select* from viewtblBill where sTrangthai = 1";
                }else if( status == "1")
                {
                    sql = "select * from viewtblBill where dThoigianthanhtoan between '" + date1 + "' and '" + date2 + "'";
                }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)";
                }
                CrystalReport_0 crystalReport_0 = new CrystalReport_0();
                crystalReport_0.SetDataSource(conn.getTable(sql));
                crystalReportViewer1.ReportSource = crystalReport_0;

            }
        }
        public int doLogin(string user, string pass)
        {
            string    sql = "Select * from tblUser where sUsername like '" + user + "' and sPassword like '" + pass + "'";
            DataTable dt  = conn.getTable(sql);

            if (dt.Rows.Count > 0)
            {
                return(int.Parse(dt.Rows[0]["iId"].ToString()));
            }
            else
            {
                return(-1);
            }
        }
        public List <Entity.Drinks> getListDrinks()
        {
            List <Entity.Drinks> lst = new List <Entity.Drinks>();
            DataTable            dt  = conn.getTable("select * from tblMenu");

            foreach (DataRow item in dt.Rows)
            {
                Entity.Drinks x = new Entity.Drinks(
                    item["iId"].ToString(),
                    item["sTendouong"].ToString(),
                    getTypeDrinks(item["sLoaidouong"].ToString()),
                    string.Format("{0:n0}", int.Parse(item["fDongia"].ToString()))
                    );
                lst.Add(x);
            }
            return(lst);
        }
        public List <Entity.typeDrinks> getListTypeDrinks()
        {
            List <Entity.typeDrinks> lst = new List <Entity.typeDrinks>();
            String    sql = "select * from tblLoaidouong";
            DataTable dt  = conn.getTable(sql);

            foreach (DataRow item in dt.Rows)
            {
                Entity.typeDrinks x = new Entity.typeDrinks(
                    item["iId"].ToString(),
                    item["sName"].ToString()
                    );
                lst.Add(x);
            }
            return(lst);
        }
        public List <Entity.Table> getListTable()
        {
            List <Entity.Table> lst = new List <Entity.Table>();
            String    sql           = "select * from tblBan";
            DataTable dt            = conn.getTable(sql);

            Debug.WriteLine(dt.Rows.Count);
            foreach (DataRow item in dt.Rows)
            {
                Entity.Table tb = new Entity.Table(
                    item["iId"].ToString(),
                    item["sName"].ToString(),
                    getStatus(item["sStatus"].ToString())
                    );
                lst.Add(tb);
            }
            return(lst);
        }
Exemplo n.º 6
0
        public List <Entity.Billinfor> getListBillinfor(string bill_id)
        {
            List <Entity.Billinfor> lst = new List <Entity.Billinfor>();
            string    sql = "select * from viewBill_Infor where sMaHD = " + bill_id;
            DataTable dt  = conn.getTable(sql);

            foreach (DataRow item in dt.Rows)
            {
                Entity.Billinfor x = new Entity.Billinfor(
                    item["iId"].ToString(),
                    item["sTendouong"].ToString(),
                    item["iSoluong"].ToString(),
                    string.Format("{0:n0}", int.Parse(item["fDongia"].ToString())),
                    item["sMaHD"].ToString()
                    );
                lst.Add(x);
            }
            return(lst);
        }
Exemplo n.º 7
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);
        }