Exemplo n.º 1
0
        public List <string> FillCodeByClass(string Class_Name)
        {
            Typer Typer = new Typer();

            List <string> Code = new List <string>();

            using (SqlConnection conn = InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT Acct_Code, Acct_Name " +
                    "FROM dbo.tbl_Particulars " +
                    "WHERE Acct_ClassId = '" + Typer.GetSelectedClassCode(Class_Name) + "'",
                    conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Code.Add(reader.GetString(0) + ": " + reader.GetString(1));
                    }
                }

                reader.Close();
            }

            return(Code);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public List <string> FillPayeeByOffice(string Office_Name)
        {
            Typer Typer = new Typer();

            List <string> Payee = new List <string>();

            if (Office_Name != "External")
            {
                using (SqlConnection conn = InitializeSqlConnection())
                {
                    SqlCommand comm = new SqlCommand(
                        "SELECT Employee_Name " +
                        "FROM dbo.tbl_Payee " +
                        "WHERE Office_Code = '" + Typer.GetSelectedOfficeCode(Office_Name) + "'",
                        conn);

                    conn.Open();

                    SqlDataReader reader = comm.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            Payee.Add(reader.GetString(0));
                        }
                    }

                    reader.Close();
                }
            }
            else
            {
                using (SqlConnection conn = InitializeSqlConnection())
                {
                    SqlCommand comm = new SqlCommand(
                        "SELECT Employee_Name " +
                        "FROM dbo.tbl_Ext_Payee",
                        conn);

                    conn.Open();

                    SqlDataReader reader = comm.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            Payee.Add(reader.GetString(0));
                        }
                    }

                    reader.Close();
                }
            }

            return(Payee);
        }
Exemplo n.º 4
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);
        }