Exemple #1
0
        public int rowCount()
        {
            String sql       = "Select count(*) from danhmuc";
            int    numberRow = Convert.ToInt32(dataProvider.ExecuteScalar(sql));

            return(numberRow);
        }
Exemple #2
0
        public int RowCount()
        {
            String sql    = "Select count(*) from nhacungcap";
            int    effect = Convert.ToInt32(dataProvider.ExecuteScalar(sql));

            return(effect);
        }
Exemple #3
0
        public int RowCount()
        {
            String sql = "select count(*) from nhanvien";
            int    row = Convert.ToInt32(dataProvider.ExecuteScalar(sql));

            return(row);
        }
Exemple #4
0
        public static int GetNumberOfBillsByTime(DateTime from, DateTime to)
        {
            provider = new DataProvider();
            provider.Connect();

            string cmdStr     = "Execute proc_GetNumberOfBillsByTime '" + from.ToString("yyyy-MM-dd") + "', '" + to.ToString("yyyy-MM-dd") + "'";
            int    numOfBills = (int)provider.ExecuteScalar(cmdStr);

            provider.Disconnect();
            return(numOfBills);
        }
 public static int GetMaxIdBill()
 {
     try
     {
         return((int)DataProvider.ExecuteScalar("SELECT MAX(id) FROM dbo.HoaDon"));
     }
     catch
     {
         return(1);
     }
 }
Exemple #6
0
        public static int GetNumberOfBills()
        {
            provider = new DataProvider();
            provider.Connect();

            string cmdStr     = "Execute proc_GetNumberOfBills";
            int    numOfBills = (int)provider.ExecuteScalar(cmdStr);

            provider.Disconnect();
            return(numOfBills);
        }
Exemple #7
0
        public static int GetMaxYear()
        {
            provider = new DataProvider();
            provider.Connect();

            string cmdStr  = "Execute proc_GetMaxYear";
            object result  = provider.ExecuteScalar(cmdStr);
            int    maxYear = result == DBNull.Value ? DateTime.Today.Year : (int)result;

            provider.Disconnect();
            return(maxYear);
        }
Exemple #8
0
        public static int GetTotalPriceByYear(int year)
        {
            provider = new DataProvider();
            provider.Connect();

            string cmdStr = "Execute proc_GetTotalPriceByYear " + year;
            int    total;
            object totalObject = provider.ExecuteScalar(cmdStr);

            total = totalObject == DBNull.Value ? 0 : (int)totalObject;
            provider.Disconnect();
            return(total);
        }
Exemple #9
0
        public int Insert(DonNhapHangDTO donNhap)
        {
            string query = "insert into donnhaphang(manv, mancc, tongluonghang, lydonhap, ngaynhap, trangthaixacnhan) output INSERTED.madonnhap values (@MANV,0,@TONGLUONGHANG,@LYDONHAP,@NGAYNHAP,0)";
            List <SqlParameter> Inserted_values = new List <SqlParameter>
            {
                new SqlParameter("@MANV", donNhap.maNV),
                new SqlParameter("@TONGLUONGHANG", donNhap.tongLuongHang),
                new SqlParameter("@LYDONHAP", donNhap.lyDoNhap),
                new SqlParameter("@NGAYNHAP", donNhap.ngayNhap)
            };

            return(dp.ExecuteScalar(query, Inserted_values));
        }
Exemple #10
0
        public static int getMaxIdBill()
        {
            string stringquery = "select max(id_Bill) from BILL";

            con = DataProvider.OpenConnection();
            try
            {
                return((int)DataProvider.ExecuteScalar(stringquery, con));
            }
            catch
            {
                return(1);
            }
        }
        ///////////////////////////
        // Lấy đúng dữ liệu đăng nhập
        ///////////////////////////
        public int LoginSuccess(string sql, string MaNV, string MatKhau)
        {
            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter("@MaNV", MaNV));
            paras.Add(new SqlParameter("@MatKhau", MatKhau));
            dp.Connect();
            try
            {
                int x = (int)dp.ExecuteScalar(sql, System.Data.CommandType.Text, paras);
                return(x);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dp.Disconnect();
            }
        }
Exemple #12
0
 public static string CreateNhanVientId()
 {
     return((string)DataProvider.ExecuteScalar("usp_CreateNhanVienId"));
 }
 public static string CreateLoaiSanPhamId()
 {
     return((string)DataProvider.ExecuteScalar("usp_CreateLoaiSanPhamId"));
 }
Exemple #14
0
 public static string CreateLoaiPhieuXuatId()
 {
     return((string)DataProvider.ExecuteScalar("usp_CreateLoaiPhieuXuatId"));
 }
Exemple #15
0
        public int MaHang()
        {
            String sql = "select ident_current('hang')";

            return(Convert.ToInt32(dataProvider.ExecuteScalar(sql)));
        }
Exemple #16
0
 public static string CreateThamSoId()
 {
     return((string)DataProvider.ExecuteScalar("usp_CreateThamSoId"));
 }
Exemple #17
0
        public int MaPhieuNhap()
        {
            String sql = "select ident_current('phieunhap')";

            return(Convert.ToInt32(dataProvider.ExecuteScalar(sql)));
        }