Example #1
0
        public POSystem(string name)
        {
            InitializeComponent();


            Cr_L_User.Text = name;
            DateTime  today     = DateTime.Today;
            int       PO_Number = 0;
            POConn    conn      = new POConn();
            DataTable PO        = conn.SelectQuery("SELECT MAX(PO_NUMBER) FROM PURCHASE_ORDERS");

            //MessageBox.Show(PO.Rows.Count.ToString());
            foreach (DataRow row in PO.Rows)
            {
                if (row[0] != DBNull.Value)
                {
                    PO_Number = Convert.ToInt32(row[0].ToString()) + 1;
                }
                else
                {
                    PO_Number = 1;
                }
            }
            Cr_L_PO.Text = PO_Number.ToString();
        }
Example #2
0
        private void L_B_OK_Click(object sender, EventArgs e)
        {
            string name = L_TB_User.Text;
            string pw   = L_TB_Password.Text;


            POConn    L_Conn = new POConn();
            DataTable cred   = L_Conn.SelectQuery("SELECT USER_NAME, PASSWORD FROM USERS WHERE USER_NAME=LOWER('" + name + "') AND PASSWORD=('" + pw + "')");


            if (cred.Rows.Count > 0)
            {
                POSystem POSystem = new POSystem(name);
                POSystem.Show();
                this.Hide();
                POSystem.FormClosing += POSystem_Closing;
            }
            else
            {
                MessageBox.Show("Incorrect User Name and/or Password");
            }
        }