Example #1
0
 private void GUI_CTTS_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (tt.Equals("Create"))
     {
         DialogResult dlr = MessageBox.Show("Bạn có chắc chắn Hủy Phiếu nhập hàng này?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (dlr == DialogResult.OK)
         {
             if (ctl.deletePN(PN))
             {
                 MessageBox.Show("Hủy Phiếu nhập hàng thành công!");
                 GUI_NHTS form = new GUI_NHTS(TK);
                 this.Hide();
                 form.ShowDialog();
                 e.Cancel = false;
             }
             else
             {
                 e.Cancel = true;
                 MessageBox.Show("Hủy phiếu nhập hàng thất bại!");
             }
         }
         else
         {
             e.Cancel = true;
         }
     }
     else if (tt.Equals("Cancel"))
     {
         GUI_NHTS form = new GUI_NHTS(TK);
         this.Hide();
         form.ShowDialog();
         e.Cancel = false;
     }
 }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(lst.Rows[lst.Rows.Count-1].Cells[1].Value.ToString());
            //THêm mới
            List <CTPHIEUNHAPHANGTRUSO> ctpn = new List <CTPHIEUNHAPHANGTRUSO>();

            for (int i = 0; i < lst.Rows.Count; i++)
            {
                CTPHIEUNHAPHANGTRUSO tmp = new CTPHIEUNHAPHANGTRUSO();
                tmp.SOPHIEUNHTS = lst.Rows[i].Cells[0].Value.ToString();
                tmp.MASP        = lst.Rows[i].Cells[2].Value.ToString();
                tmp.SOLUONG     = int.Parse(lst.Rows[i].Cells[3].Value.ToString());
                tmp.GIANHAP     = ulong.Parse(lst.Rows[i].Cells[5].Value.ToString());
                tmp.HANSD       = DateTime.Parse(lst.Rows[i].Cells[6].Value.ToString());
                tmp.TINHTRANG   = lst.Rows[i].Cells[4].Value.ToString();
                ctpn.Add(tmp);
            }
            if (ctl.addListCTNHTS(ctpn))
            {
                if (ctl.updatePNHTS(PN, txtTongTien.Text, cbSP.Text))
                {
                    GUI_NHTS form = new GUI_NHTS(TK);
                    tt = "Cancel";
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Thất bại!");
                }
            }
            else
            {
                MessageBox.Show("Thất bại!");
            }
        }
Example #3
0
        private void GUI_CTTS_Update_FormClosing(object sender, FormClosingEventArgs e)
        {
            GUI_NHTS form = new GUI_NHTS(TK);

            this.Hide();
            form.ShowDialog();
            e.Cancel = false;
        }
Example #4
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            string sTmp = "";
            bool   flg  = true;

            if (!vl.Required(txtUser.Text))
            {
                sTmp = sTmp + "Vui lòng điền tên đăng nhập!\n";
                flg  = false;
            }
            if (!vl.Required(txtPass.Text))
            {
                sTmp = sTmp + "Vui lòng điền mật khẩu!\n";
                flg  = false;
            }
            if (flg)
            {
                try
                {
                    TK = db.TAIKHOANs.Single(st => st.TENDANGNHAP.Equals(txtUser.Text) && st.MATKHAU.Equals(txtPass.Text));
                    if (TK.QUYEN.Equals("Giám đốc"))
                    {
                        GUI_Thongke tk = new GUI_Thongke(TK);
                        this.Hide();
                        tk.ShowDialog();
                        this.Close();
                    }
                    else if (TK.QUYEN.Equals("Nhân viên bán hàng"))
                    {
                        QLHD.GUI_POS sp = new QLHD.GUI_POS(TK, "Login");
                        this.Hide();
                        sp.ShowDialog();
                        this.Close();
                    }
                    else if (TK.QUYEN.Equals("Quản lý chi nhánh"))
                    {
                        QLNH.GUI_DX sp = new QLNH.GUI_DX(TK);
                        this.Hide();
                        sp.ShowDialog();
                        this.Close();
                    }
                    else if (TK.QUYEN.Equals("Nhân viên kiểm kho"))
                    {
                        QLNH.GUI_NHTS sp = new QLNH.GUI_NHTS(TK);
                        this.Hide();
                        sp.ShowDialog();
                        this.Close();
                    }
                    else if (TK.QUYEN.Equals("Thư ký"))
                    {
                        Dexuat.GUI_DX sp = new Dexuat.GUI_DX(TK);
                        this.Hide();
                        sp.ShowDialog();
                        this.Close();
                    }
                }
                catch
                {
                    MessageBox.Show("Tên đăng nhập hoặc mật khẩu không chính xác!");
                    txtPass.Text = "";
                }
            }
            else
            {
                MessageBox.Show(sTmp);
            }
        }