Ejemplo n.º 1
0
        public List <Entities.BURModel> FillGrid()
        {
            List <Entities.BURModel> BUR = new List <Entities.BURModel>();
            Typer Typer = new Typer();

            SqlConnection conn = InitializeSqlConnection();

            using (conn)
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT * FROM dbo.tbl_BUR ORDER BY BUR_FDate ASC", conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        BUR.Add(
                            new Entities.BURModel()
                        {
                            BURNumber = reader.GetString(1),
                            Date      = reader.GetDateTime(2).ToString(),
                            Office    = Typer.GetSelectedOfficeName(reader.GetString(3)),
                            Staff     = Typer.GetSelectedStaffName(reader.GetString(5)),
                            Payee     = Typer.GetSelectedPayeeName(reader.GetString(6))
                        });
                    }
                }
            }

            return(BUR);
        }
Ejemplo n.º 2
0
        public List <BURModel> FillGrid(string text)
        {
            Typer           typer = new Typer();
            List <BURModel> BUR   = new List <BURModel>();
            Typer           Typer = new Typer();

            SqlConnection conn = InitializeSqlConnection();

            using (conn)
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT * FROM dbo.tbl_BUR " +
                    "WHERE BUR_No LIKE '%" + text + "%'" /* "OR " +
                                                          * "Office_Code LIKE '%" + typer.GetSelectedOfficeCode(text) + "%' OR " +
                                                          * "Employee_Number LIKE '%" + typer.GetPayeeId(text) + "%' OR " +
                                                          * "BStaff_Number LIKE '%" + typer.GetSelectedStaffCode(text) + "%'" */, conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        BUR.Add(
                            new BURModel()
                        {
                            BURNumber = reader.GetString(1),
                            Date      = reader.GetDateTime(2).ToString(),
                            Office    = Typer.GetSelectedOfficeName(reader.GetString(3)),
                            Staff     = Typer.GetSelectedStaffName(reader.GetString(5)),
                            Payee     = Typer.GetSelectedPayeeName(reader.GetString(6))
                        });
                    }
                }
            }

            return(BUR);
        }