예제 #1
0
        public static BanHang_NhanVien getFromReader(IDataReader rd)
        {
            var Item = new BanHang_NhanVien();

            if (rd.FieldExists("BHNV_ID"))
            {
                Item.ID = (Int64)(rd["BHNV_ID"]);
            }
            if (rd.FieldExists("BHNV_PLV_ID"))
            {
                Item.PLV_ID = (Int64)(rd["BHNV_PLV_ID"]);
            }
            if (rd.FieldExists("BHNV_NhanVien"))
            {
                Item.NhanVien = (String)(rd["BHNV_NhanVien"]);
            }
            if (rd.FieldExists("BHNV_Luong"))
            {
                Item.Luong = (Double)(rd["BHNV_Luong"]);
            }
            if (rd.FieldExists("BHNV_Ngay"))
            {
                Item.Ngay = (DateTime)(rd["BHNV_Ngay"]);
            }
            if (rd.FieldExists("BHNV_LamViec"))
            {
                Item.LamViec = (Boolean)(rd["BHNV_LamViec"]);
            }
            if (rd.FieldExists("BHNV_Ten"))
            {
                Item.Ten = (String)(rd["BHNV_Ten"]);
            }
            return(Item);
        }
예제 #2
0
        public static BanHang_NhanVien Update(BanHang_NhanVien item)
        {
            var Item = new BanHang_NhanVien();
            var obj  = new SqlParameter[5];

            obj[0] = new SqlParameter("BHNV_ID", item.ID);
            obj[1] = new SqlParameter("BHNV_PLV_ID", item.PLV_ID);
            obj[2] = new SqlParameter("BHNV_NhanVien", item.NhanVien);
            obj[3] = new SqlParameter("BHNV_Luong", item.Luong);
            if (item.Ngay > DateTime.MinValue)
            {
                obj[4] = new SqlParameter("BHNV_Ngay", item.Ngay);
            }
            else
            {
                obj[4] = new SqlParameter("BHNV_Ngay", DBNull.Value);
            }

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblBanHang_NhanVien_Update_UpdateNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
예제 #3
0
        public static BanHang_NhanVien SelectById(Int64 BHNV_ID)
        {
            var Item = new BanHang_NhanVien();
            var obj  = new SqlParameter[1];

            obj[0] = new SqlParameter("BHNV_ID", BHNV_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblBanHang_NhanVien_Select_SelectById_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }