예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tenNguyenLieu">tên nguyên liệu </param>
        /// <param name="maNhaCungCap">mã nhà cung cấp</param>
        /// <returns></returns>
        public static DataTable TiemKiemNguyenLieu(string tenNguyenLieu, string maNhaCungCap, bool isXemToiThieu, int pageNumber, int pageSize,
                                                   List <string> exceptList = null)
        {
            DataTable table = NguyenLieuDAO.XemNguyenLieu(tenNguyenLieu, maNhaCungCap, isXemToiThieu, pageNumber, pageSize);

            if (exceptList != null)
            {
                foreach (string item in exceptList)
                {
                    if (item != null)
                    {
                        try
                        {
                            table = table.Select("manl <> '" + item + "'").CopyToDataTable();
                        }
                        catch (Exception ex)
                        {
                            Utility.Log(ex);
                            table.Clear();
                        }
                    }
                }
            }
            return(table);
        }
예제 #2
0
        public static List <NguyenLieu> TimKiemDanhSachNguyenLieu(string tenNguyenLieu, string maNhaCungCap, bool isXemToiThieu, int pageNumber, int pageSize)
        {
            DataTable         table = NguyenLieuDAO.XemNguyenLieu(tenNguyenLieu, maNhaCungCap, isXemToiThieu, pageNumber, pageSize);
            List <NguyenLieu> list  = table.AsEnumerable().ToList().ConvertAll(x =>
                                                                               new NguyenLieu()
            {
                Ma              = x[0].ToString(),
                Ten             = x[1].ToString(),
                NhaCungCap      = x[2].ToString(),
                Dongia          = uint.Parse(x[4].ToString()),
                DonViTinh       = x[3].ToString(),
                SoLuongTon      = int.Parse(x[5].ToString()),
                SoLuongToiThieu = int.Parse(x[6].ToString()),
            });

            return(list);
        }