示例#1
0
        public static int ThemMonAn(int mode, MonAn_DTO MonAn, string maNH)
        {
            Provider provider = new Provider();
            string   store    = "sp_ThemMonAn";

            if (mode == 3)
            {
                store = "sp_ThemMonAn_Fix";
            }
            //string sql = string.Format("insert into MonAn(TenMon,LoaiMon,Gia,DonViTinh,MaNH) values ('{0}','{1}','{2}','{3}','{4}')", MonAn.tenmon, MonAn.Mamon, MonAn.Gia, MonAn.Dvtinh,maNH);
            SqlCommand cm = provider.CreateCommandStoreName(store);

            cm.Parameters.Add("@TenMon", SqlDbType.NVarChar, 50);
            cm.Parameters.Add("@LoaiMon", SqlDbType.NChar, 20);
            cm.Parameters.Add("@Gia", SqlDbType.Int);
            cm.Parameters.Add("@DonViTinh", SqlDbType.NVarChar, 20);
            cm.Parameters.Add("@MaNH", SqlDbType.NChar, 5);

            cm.Parameters["@TenMon"].Value    = MonAn.tenmon;
            cm.Parameters["@LoaiMon"].Value   = MonAn.Mamon;
            cm.Parameters["@Gia"].Value       = MonAn.Gia;
            cm.Parameters["@DonViTinh"].Value = MonAn.Dvtinh;
            cm.Parameters["@MaNH"].Value      = maNH;
            return(provider.ExecuteInsertUpdateDelete(cm));
        }
示例#2
0
        public static int CapNhatMonAn(int mode, MonAn_DTO MonAn, int maMonAn)
        {
            Provider provider = new Provider();
            string   store    = "sp_CapNhatMonAn";

            if (mode == 3)
            {
                store = "sp_CapNhatMonAn_Fix";
            }
            //chua xu ly nha hang
            // string sql = string.Format("update MonAn set TenMon=N'{0}',Gia='{1}',DonViTinh='{2}' where MaMon='{3}' and MaNH='{4}'", MonAn.tenmon, MonAn.Gia, MonAn.Dvtinh, maMonAn,maNH);

            SqlCommand cm = provider.CreateCommandStoreName(store);

            cm.Parameters.Add("@TenMon", SqlDbType.NVarChar, 50);
            cm.Parameters.Add("@gia", SqlDbType.Money);
            cm.Parameters.Add("@DVTinh", SqlDbType.NVarChar, 10);
            cm.Parameters.Add("@MaMon", SqlDbType.Int);

            cm.Parameters["@TenMon"].Value = MonAn.tenmon;
            cm.Parameters["@gia"].Value    = MonAn.Gia;
            cm.Parameters["@DVTinh"].Value = MonAn.Dvtinh;
            cm.Parameters["@MaMon"].Value  = maMonAn;
            return(provider.ExecuteInsertUpdateDelete(cm));
        }
示例#3
0
        public DataTable SelectMonAnTheoLoai(String maloai, String manh)
        {
            SqlCommand cm = provider.CreateCommandStoreName("sp_SelectMonAnTheoLoai");

            cm.Parameters.Add("@maloai", SqlDbType.NChar);
            cm.Parameters.Add("@manh", SqlDbType.NChar);
            cm.Parameters["@maloai"].Value = maloai;
            cm.Parameters["@manh"].Value   = manh;
            return(provider.ExecSelectCommand(cm));
        }
示例#4
0
        //public static  DataTable DocMonAn(string maNH)
        //{
        //    Provider provider=new Provider();
        //    string str_sql = "select MaMon, TenMon,TenLoai,Gia,DonViTinh,TenNH";
        //    str_sql+= " from MonAn m,LoaiMonAn lm,NhaHang nh";
        //    str_sql+= " where m.LoaiMon=lm.MaLoai and m.MaNH=nh.MaNH and nh.MaNH="+maNH;
        //    SqlCommand cm = provider.CreateCommandStringSql(str_sql);
        //    DataTable tb = new DataTable();
        //    return provider.ExecSelectCommand(cm);
        //}
        public static DataTable DocMonAn(int mode,string maNH)
        {
            Provider provider = new Provider();
            string store = "sp_DocMonAn";
            if (mode == 3)
                store = "sp_DocMonAn_Fix";

            SqlCommand cm = provider.CreateCommandStoreName(store);
            cm.Parameters.Add("@MaNH", SqlDbType.VarChar, 5);
            cm.Parameters["@MaNH"].Value = maNH;
            return provider.ExecSelectCommand(cm);
        }
示例#5
0
        public int SelectUser(string username, string pass)
        {
            SqlCommand cm = provider.CreateCommandStoreName("sp_SelectUser");

            cm.Parameters.Add("@username", SqlDbType.NVarChar);
            cm.Parameters.Add("@pass", SqlDbType.NVarChar);
            cm.Parameters.Add("@kq", SqlDbType.Int).Direction = ParameterDirection.Output;

            cm.Parameters["@username"].Value = username;
            cm.Parameters["@pass"].Value     = pass;
            provider.ExecSelectCommand(cm);
            return((int)cm.Parameters["@kq"].Value);
        }
示例#6
0
        public int ThemHoaDon(int maBan, int maNV)
        {
            SqlCommand cm = provider.CreateCommandStoreName("sp_insertHoaDon");

            cm.Parameters.Add("@maban", SqlDbType.Int);
            cm.Parameters["@maban"].Value = maBan;
            cm.Parameters.Add("@manv", SqlDbType.Int);
            cm.Parameters["@manv"].Value = maNV;
            int t = provider.ExecuteInsertUpdateDelete(cm);

            return(t);
        }
示例#7
0
        public List <BanAn_DTO> SelectBanAnTheoTrangThai(int trangthai, int manh, int mode)
        {
            String store = "sp_selectBanAn_0";

            switch (mode)
            {
            case 0:
                store = "sp_selectBanAn_0";
                break;

            case 3:
                store = "sp_selectBanAn_3";
                break;
            }

            SqlCommand cm = provider.CreateCommandStoreName(store);

            cm.Parameters.Add("@trangthai", SqlDbType.Int);
            cm.Parameters.Add("@manh", SqlDbType.Int);

            cm.Parameters["@trangthai"].Value = trangthai;
            cm.Parameters["@manh"].Value      = manh;
            return(ConvertToList(provider.ExecSelectCommand(cm)));
        }
示例#8
0
        //public static  DataTable DocMonAn(string maNH)
        //{
        //    Provider provider=new Provider();
        //    string str_sql = "select MaMon, TenMon,TenLoai,Gia,DonViTinh,TenNH";
        //    str_sql+= " from MonAn m,LoaiMonAn lm,NhaHang nh";
        //    str_sql+= " where m.LoaiMon=lm.MaLoai and m.MaNH=nh.MaNH and nh.MaNH="+maNH;
        //    SqlCommand cm = provider.CreateCommandStringSql(str_sql);
        //    DataTable tb = new DataTable();
        //    return provider.ExecSelectCommand(cm);
        //}

        public static DataTable DocMonAn(int mode, string maNH)
        {
            Provider provider = new Provider();
            string   store    = "sp_DocMonAn";

            if (mode == 3)
            {
                store = "sp_DocMonAn_Fix";
            }

            SqlCommand cm = provider.CreateCommandStoreName(store);

            cm.Parameters.Add("@MaNH", SqlDbType.VarChar, 5);
            cm.Parameters["@MaNH"].Value = maNH;
            return(provider.ExecSelectCommand(cm));
        }
示例#9
0
        public static int XoaMonAn(int mode, int maMonAn)
        {
            Provider provider = new Provider();
            //chua xu ly nha hang
            // string sql = string.Format("delete MonAn  where MaMon={0}", maMonAn);
            string store = "sp_XoaMonAn";

            if (mode == 3)
            {
                store = "sp_XoaMonAn_Fix";
            }

            SqlCommand cm = provider.CreateCommandStoreName(store);

            cm.Parameters.Add("@maMon", SqlDbType.Int);
            cm.Parameters["@maMon"].Value = maMonAn;
            return(provider.ExecuteInsertUpdateDelete(cm));
        }
示例#10
0
        public static int CapNhatMonAn(int mode,MonAn_DTO MonAn, int maMonAn)
        {
            Provider provider = new Provider();
            string store="sp_CapNhatMonAn";
            if(mode==3)
                store = "sp_CapNhatMonAn_Fix";
            //chua xu ly nha hang
               // string sql = string.Format("update MonAn set TenMon=N'{0}',Gia='{1}',DonViTinh='{2}' where MaMon='{3}' and MaNH='{4}'", MonAn.tenmon, MonAn.Gia, MonAn.Dvtinh, maMonAn,maNH);

            SqlCommand cm = provider.CreateCommandStoreName(store);
            cm.Parameters.Add("@TenMon", SqlDbType.NVarChar, 50);
            cm.Parameters.Add("@gia", SqlDbType.Money);
            cm.Parameters.Add("@DVTinh", SqlDbType.NVarChar, 10);
            cm.Parameters.Add("@MaMon", SqlDbType.Int);

            cm.Parameters["@TenMon"].Value = MonAn.tenmon;
            cm.Parameters["@gia"].Value = MonAn.Gia;
            cm.Parameters["@DVTinh"].Value = MonAn.Dvtinh;
            cm.Parameters["@MaMon"].Value = maMonAn;
            return provider.ExecuteInsertUpdateDelete(cm);
        }
示例#11
0
        public static DataTable TimTheoLoai(int mode, string maLoai, string MaNH, ref int sl)
        {
            Provider provider = new Provider();
            string   store    = "sp_TimTheoLoai";

            if (mode == 3)
            {
                store = "sp_TimTheoLoai_Fix";
            }

            SqlCommand cm = provider.CreateCommandStoreName(store);

            cm.Parameters.Add("@maLoai", SqlDbType.VarChar, 5);
            cm.Parameters.Add("@maNH", SqlDbType.VarChar, 5);
            cm.Parameters.Add("@dem", SqlDbType.Int);

            cm.Parameters["@maLoai"].Value = maLoai;
            cm.Parameters["@maNH"].Value   = MaNH;

            cm.Parameters["@dem"].Direction = ParameterDirection.Output;
            string name = "@dem";

            return(provider.ExecSelectCommand_Output(cm, name, ref sl));
        }
        public List <ChiTietHoaDon_DTO> SelectCTHDtheoMaHD(int mahd, int mode)
        {
            String store = "sp_SelectChiTietHD_0";

            switch (mode)
            {
            case 0:
                store = "sp_SelectChiTietHD_0";
                break;

            case 3:
                store = "sp_SelectChiTietHD_3";       //unrepeatable read
                break;
            }
            SqlCommand cm = provider.CreateCommandStoreName(store);

            cm.Parameters.Add("@mahd", SqlDbType.Int);
            cm.Parameters["@mahd"].Value = mahd;
            return(ConvertToList(provider.ExecSelectCommand(cm)));
        }
示例#13
0
        public static int XoaMonAn(int mode,int maMonAn)
        {
            Provider provider = new Provider();
            //chua xu ly nha hang
               // string sql = string.Format("delete MonAn  where MaMon={0}", maMonAn);
               string  store= "sp_XoaMonAn";
               if(mode==3)
               store = "sp_XoaMonAn_Fix";

            SqlCommand cm = provider.CreateCommandStoreName(store);
            cm.Parameters.Add("@maMon", SqlDbType.Int);
            cm.Parameters["@maMon"].Value = maMonAn;
            return provider.ExecuteInsertUpdateDelete(cm);
        }
示例#14
0
        public static DataTable TimTheoLoai(int mode,string maLoai, string MaNH,ref int sl)
        {
            Provider provider = new Provider();
            string store="sp_TimTheoLoai";
            if(mode==3)
                store = "sp_TimTheoLoai_Fix";

            SqlCommand cm = provider.CreateCommandStoreName(store);
            cm.Parameters.Add("@maLoai", SqlDbType.VarChar, 5);
            cm.Parameters.Add("@maNH", SqlDbType.VarChar, 5);
            cm.Parameters.Add("@dem", SqlDbType.Int);

            cm.Parameters["@maLoai"].Value = maLoai;
            cm.Parameters["@maNH"].Value = MaNH;

            cm.Parameters["@dem"].Direction = ParameterDirection.Output;
            string name="@dem";
            return provider.ExecSelectCommand_Output(cm, name,ref sl);
        }
示例#15
0
        public static int ThemMonAn(int mode,MonAn_DTO MonAn,string maNH)
        {
            Provider provider = new Provider();
            string  store="sp_ThemMonAn";

            if(mode==3)
                store = "sp_ThemMonAn_Fix";
            //string sql = string.Format("insert into MonAn(TenMon,LoaiMon,Gia,DonViTinh,MaNH) values ('{0}','{1}','{2}','{3}','{4}')", MonAn.tenmon, MonAn.Mamon, MonAn.Gia, MonAn.Dvtinh,maNH);
            SqlCommand cm = provider.CreateCommandStoreName(store);
            cm.Parameters.Add("@TenMon", SqlDbType.NVarChar,50);
            cm.Parameters.Add("@LoaiMon", SqlDbType.NChar, 20);
            cm.Parameters.Add("@Gia", SqlDbType.Int);
            cm.Parameters.Add("@DonViTinh", SqlDbType.NVarChar, 20);
            cm.Parameters.Add("@MaNH", SqlDbType.NChar, 5);

            cm.Parameters["@TenMon"].Value = MonAn.tenmon;
            cm.Parameters["@LoaiMon"].Value = MonAn.Mamon;
            cm.Parameters["@Gia"].Value = MonAn.Gia;
            cm.Parameters["@DonViTinh"].Value = MonAn.Dvtinh;
            cm.Parameters["@MaNH"].Value = maNH;
            return provider.ExecuteInsertUpdateDelete(cm);
        }