Ejemplo n.º 1
0
        private void stockToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmStock obj = new frmStock();

            obj.MdiParent = this;
            obj.Show();
        }
Ejemplo n.º 2
0
 private void btnStock_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (fr11 == null)
     {
         fr11           = new frmStock();
         fr11.MdiParent = this;
         fr11.Show();
     }
 }
Ejemplo n.º 3
0
        private void newProductToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmStock frm = new frmStock();

            frm.TopLevel = false;
            panelParent.Controls.Add(frm);
            frm.BringToFront();
            frm.Show();
        }
Ejemplo n.º 4
0
 private void stockToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (stock.IsDisposed)
     {
         stock = new frmStock();
     }
     stock.MdiParent = this;
     stock.Show();
     stock.BringToFront();
 }
Ejemplo n.º 5
0
 private void tsbStock_Click(object sender, EventArgs e)
 {
     if (m_frmStock == null || m_frmStock.IsDisposed)
     {
         m_frmStock           = new frmStock(this._SystemUser);
         m_frmStock.MdiParent = this;
     }
     this._SearchGood   = m_frmStock.ISearchGood;
     m_frmStock.Visible = false;
     m_frmStock.Activate();
     m_frmStock.WindowState = FormWindowState.Maximized;
     m_frmStock.Show();
     this.tsslCurrent.Text = "当前操作:库存管理";
     m_iOutput             = m_frmStock.IOutput;
 }
Ejemplo n.º 6
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            // ตรวจสอบการป้อนข้อมูล
            if (txtUsername.Text == "" || txtPassword.Text == "")
            {
                MessageBox.Show("ป้อนข้อมูลให้ครับก่อน", "ผิดพลาด",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            // มีการป้อนข้อมูลแล้ว นำ username, password ไปตรวจสอบกับข้อมูลในตาราง
            string connectionString = "server=.\\sqlexpress;database=dbBookShop;integrated security=true";

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                con.Open();
                // MessageBox.Show("connect ok");
                // คลาสที่ใช้งานในการ SELECT ข้อมูล sqlDataAdapter, DataTable, คำสั่ง SQL
                //     string sql = "SELECT * FROM tbEmployee WHERE  Username='******' AND Password='******' ";
                string         sql = "SELECT * FROM tbEmployee WHERE Username=@Username AND Password=@Password";
                SqlDataAdapter da  = new SqlDataAdapter(sql, con);
                da.SelectCommand.Parameters.AddWithValue("@Username", txtUsername.Text);
                da.SelectCommand.Parameters.AddWithValue("@Password", txtPassword.Text);
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows.Count < 1)
                {
                    MessageBox.Show("ไม่พบข้อมูล", "ผิดพลาด",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                // กรณีพบข้อมูล ตรวจสอบสถานะผู้ใช้งาน
                if (dt.Rows[0]["PosID"].ToString() == "1")
                {
                    // MessageBox.Show("พนักงานขาย");
                    frmSaleMenu frm = new frmSaleMenu(dt.Rows[0]["EmpName"].ToString(), dt.Rows[0]["EmpID"].ToString());
                    frm.Show();
                    this.Hide();
                }
                else if (dt.Rows[0]["PosID"].ToString() == "2")
                {
                    // MessageBox.Show("พนักงานคลังสินค้า");
                    int      EmpID = int.Parse(dt.Rows[0]["EmpID"].ToString());
                    frmStock frm   = new frmStock(EmpID);
                    frm.Show();
                    this.Hide();
                }
                else if (dt.Rows[0]["PosID"].ToString() == "3")
                {
                    //  MessageBox.Show("ผู้จัดการร้าน");
                    frmManager frm = new frmManager();
                    frm.Show();
                }
                else if (dt.Rows[0]["PosID"].ToString() == "4")
                {
                    /// MessageBox.Show("ผู้ดูแลระบบ");
                    frmAdmin frm = new frmAdmin(dt.Rows[0]["EmpName"].ToString());
                    frm.Show();
                }
            }
        }