Esempio n. 1
0
        public string GetSelectedOfficeCode(string Office_Name)
        {
            DbLink DbLink      = new DbLink();
            string Office_Code = "12";

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT Office_Code " +
                    "FROM dbo.tbl_A_Certified " +
                    "WHERE Office_NameAbbr = '" + Office_Name + "'",
                    conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();


                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Office_Code = reader.GetString(0);
                    }
                }

                reader.Close();
            }

            return(Office_Code);
        }
Esempio n. 2
0
        public string GetUserImage(string userName)
        {
            DbLink DbLink = new DbLink();
            string picURL = "";

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT  PicURL " +
                    "FROM dbo.tbl_BO_Staff " +
                    "WHERE BStaff_Number = '" + userName + "'",
                    conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();


                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        picURL = reader.GetString(0);
                    }
                }

                reader.Close();
            }

            return(picURL);
        }
Esempio n. 3
0
        public string[] GetOfficeHeadName(string officeCode)
        {
            DbLink DbLink = new DbLink();

            string[] Officehead = new string[2];

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT A.Officehead_Name, A.Officehead_Pos " +
                    "FROM dbo.tbl_Officehead AS A " +
                    "INNER JOIN dbo.tbl_A_Certified AS B " +
                    "ON A.OfficeheadId = B.OfficeheadId " +
                    "WHERE B.Office_Code = '" + officeCode + "'", conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Officehead[0] = reader.GetString(0);
                        Officehead[1] = reader.GetString(1);
                    }
                }
            }

            return(Officehead);
        }
Esempio n. 4
0
        public string GetSelectedPayeeNumber(string payeeName)
        {
            string payeeNumber = "";
            DbLink Link        = new DbLink();

            using (SqlConnection conn = Link.InitializeSqlConnection())
            {
                conn.Open();

                SqlCommand comm = new SqlCommand("SELECT Employee_Number FROM dbo.tbl_Payee " +
                                                 "WHERE Employee_Name = '" + payeeName + "'", conn);

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        payeeNumber = reader.GetString(0);
                    }
                }
            }

            return(payeeNumber);
        }
Esempio n. 5
0
        public string GetAcctName(string code)
        {
            DbLink DbLink    = new DbLink();
            string Acct_Name = "";

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

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Acct_Name = reader.GetString(0);
                    }
                }
            }

            return(Acct_Name);
        }
Esempio n. 6
0
        public int GetSelectedClassCode(string Class_Name)
        {
            DbLink DbLink     = new DbLink();
            int    Class_Code = 0;

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT Acct_ClassId " +
                    "FROM dbo.tbl_Classification " +
                    "WHERE Acct_Class_Name = '" + Class_Name + "'",
                    conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();


                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Class_Code = reader.GetInt32(0);
                    }
                }

                reader.Close();
            }

            return(Class_Code);
        }
Esempio n. 7
0
        public string GetSelectedBDHeadName(string BDHead_Number)
        {
            DbLink DbLink      = new DbLink();
            string BDHead_Name = "";

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT BDHead_Name " +
                    "FROM dbo.tbl_B_Certified " +
                    "WHERE BDHead_Number = '" + BDHead_Number + "'",
                    conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        BDHead_Name = reader.GetString(0);
                    }
                }

                reader.Close();
            }

            return(BDHead_Name);
        }
Esempio n. 8
0
        public string GetClassName(string code)
        {
            DbLink DbLink = new DbLink();

            string Acct_Class_Name = "";

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT A.Acct_Class_Name " +
                    "FROM dbo.tbl_Classification AS A " +
                    "INNER JOIN dbo.tbl_Particulars AS B " +
                    "ON A.Acct_ClassId = B.Acct_ClassId " +
                    "WHERE B.Acct_Code = '" + code + "'", conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Acct_Class_Name = reader.GetString(0);
                    }
                }
            }

            return(Acct_Class_Name);
        }
Esempio n. 9
0
        public string GetSelectedPayeeName(string Payee_Number)
        {
            DbLink DbLink = new DbLink();
            string Payee  = "";

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT Employee_Name " +
                    "FROM dbo.tbl_Payee " +
                    "WHERE Employee_Number = '" + Payee_Number + "'",
                    conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

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

                reader.Close();
            }

            if (Payee == "")
            {
                Payee = Payee_Number;
            }

            return(Payee);
        }
Esempio n. 10
0
        public string GetSelectedStaffName(string BStaff_Number)
        {
            DbLink DbLink      = new DbLink();
            string BStaff_Name = "";

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT A.Employee_Name " +
                    "FROM dbo.tbl_Payee AS A " +
                    "INNER JOIN dbo.tbl_BO_Staff AS B ON A.Employee_Number = B.BStaff_Number " +
                    "WHERE B.BStaff_Number = '" + BStaff_Number + "'",
                    conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        BStaff_Name = reader.GetString(0);
                    }
                }

                reader.Close();
            }

            return(BStaff_Name);
        }
Esempio n. 11
0
        public string GetPosition(string userName)
        {
            DbLink DbLink   = new DbLink();
            string Password = "";

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT A.Employee_Pos FROM dbo.tbl_Payee AS A INNER JOIN dbo.tbl_BO_Staff AS B ON A.Employee_Number = B.BStaff_Number WHERE BStaff_Number = '" + userName + "'", conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Password = reader.GetString(0);
                    }
                }
            }

            return(Password);
        }
Esempio n. 12
0
        public string GetPayeeId(string Payee)
        {
            DbLink DbLink          = new DbLink();
            string Employee_Number = "";

            using (SqlConnection conn = DbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT Employee_Number " +
                    "FROM dbo.tbl_Payee " +
                    "WHERE Employee_Name = '" + Payee + "'",
                    conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();


                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Employee_Number = reader.GetString(0);
                    }
                }
                else
                {
                    reader.Close();
                    comm = new SqlCommand(
                        "SELECT Employee_Number " +
                        "FROM dbo.tbl_Ext_Payee " +
                        "WHERE Employee_Name = '" + Payee + "'",
                        conn);

                    reader = comm.ExecuteReader();


                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            Employee_Number = reader.GetString(0);
                        }
                    }
                }

                reader.Close();
            }

            return(Employee_Number);
        }
Esempio n. 13
0
        public bool CheckIfAdmin(string userName)
        {
            DbLink dbLink = new DbLink();

            using (SqlConnection conn = dbLink.InitializeSqlConnection())
            {
                SqlCommand comm = new SqlCommand(
                    "SELECT * FROM dbo.tbl_BO_Staff " +
                    "WHERE BStaff_Number = '" + userName + "' AND " +
                    "Discriminator = 'Admin'", conn);

                conn.Open();

                SqlDataReader reader = comm.ExecuteReader();

                return(reader.HasRows);
            }
        }