コード例 #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (fgQD.Row < fgQD.Rows.Fixed)
            {
                BaseMessages.ShowInformationMessage("Chưa chọn quyết định.");
                return;
            }
            if (BaseMessages.ShowDeleteQuestionMessage() == DialogResult.No)
            {
                return;
            }

            clsQD_NhapVatTu cls = new clsQD_NhapVatTu();

            cls.ID_QuyetDinh = int.Parse(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh"));
            cls.SelectOne();
            cls.TonTai = false;
            cls.Update();
            BaseMessages.ShowInformationMessage("Xóa thành công!");

            LockEdit(true);
            Loadfg();

            ResetTextboxs();
            fgChiTiet.Rows.Count = fgChiTiet.Rows.Fixed;
        }
コード例 #2
0
        private void Duyet(string question, byte trangthai, string message)
        {
            if (fgQD.Row < fgQD.Rows.Fixed)
            {
                BaseMessages.ShowInformationMessage("Chưa chọn quyết định.");
                return;
            }
            if (MessageBox.Show(question, "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            int  fgRow             = fgQD.Row;
            byte previousTrangThai = Convert.ToByte(fgQD[fgQD.Row, "TrangThai"]);

            clsQD_NhapVatTu cls = new clsQD_NhapVatTu();

            cls.ID_QuyetDinh = int.Parse(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh"));
            cls.SelectOne();
            cls.TrangThai = trangthai;
            cls.Update();
            BaseMessages.ShowInformationMessage(message);
            if (trangthai == 1)
            {
                fgQD[fgQD.Row, "Ten_TrangThai"] = "Trình duyệt";
                fgQD[fgQD.Row, "TrangThai"]     = 1;
                fgQD.Rows[fgQD.Row].Style       = cs2;
            }
            else if (trangthai == 3)
            {
                fgQD[fgQD.Row, "Ten_TrangThai"] = "Hủy duyệt";
                fgQD[fgQD.Row, "TrangThai"]     = 3;
                fgQD.Rows[fgQD.Row].Style       = cs3;
                CapNhatSLVatTuKhoVer2(Convert.ToInt32(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh")), 3);
            }
            else if (trangthai == 5)
            {
                fgQD[fgQD.Row, "Ten_TrangThai"] = "Phê duyệt";
                fgQD[fgQD.Row, "TrangThai"]     = 5;
                fgQD.Rows[fgQD.Row].Style       = cs4;
            }
            else if (trangthai == 6)
            {
                fgQD[fgQD.Row, "Ten_TrangThai"] = "Ghi thẻ kho";
                fgQD[fgQD.Row, "TrangThai"]     = 6;
                fgQD.Rows[fgQD.Row].Style       = cs5;
                CapNhatSLVatTuKhoVer2(Convert.ToInt32(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh")), 6);
            }
            LockEdit(true);
            Lock(false, false, false, false, false, false);
            fgQD.Row = -1;

            ResetTextboxs();
            fgChiTiet.Rows.Count = fgChiTiet.Rows.Fixed;
            //focus
            fgQD.Row = fgRow;
        }
コード例 #3
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            int fgRow = 0;

            if (!IsValid() || !IsValidChiTiet())
            {
                return;
            }

            clsQD_NhapVatTu cls = new clsQD_NhapVatTu();

            cls.So_QuyetDinh   = txtSoQuyetDinh.Text.Trim();
            cls.Ngay_QuyetDinh = Convert.ToDateTime(dtmNgayQD.Value);
            cls.ID_NhaCungCap  = int.Parse(cmbNhaCungCap.EditValue.ToString());
            SqlDateTime currentDateTime = (new clsFunctions()).SelectCurrentDateTime();

            cls.TonTai = true;

            if (m_blFlag) //Them moi' quyet dinh
            {
                cls.NgayLap      = currentDateTime;
                cls.Ngay_SuaCuoi = currentDateTime;
                cls.TrangThai    = 0;
                cls.Insert();
                SaveDataChiTiet(int.Parse(cls.ID_QuyetDinh.ToString()));
            }
            else //Sua quyet dinh
            {
                fgRow            = fgQD.Row; //lưu lại vị trí dòng đang sửa
                cls.ID_QuyetDinh = Convert.ToInt32(fgQD.GetDataDisplay(fgQD.Row, "ID_QuyetDinh"));
                cls.Ngay_SuaCuoi = currentDateTime;
                cls.NgayLap      = Convert.ToDateTime(fgQD.GetData(fgQD.Row, "NgayLap"));
                cls.TrangThai    = Convert.ToByte(fgQD.GetDataDisplay(fgQD.Row, "TrangThai"));
                cls.Update();
                SaveDataChiTiet(int.Parse(cls.ID_QuyetDinh.ToString()));
            }

            BaseMessages.ShowInformationMessage("Cập nhật thành công!");
            LockEdit(true);
            LockEditfgChiTiet(true);
            Loadfg();

            ResetTextboxs();
            fgChiTiet.Rows.Count = fgChiTiet.Rows.Fixed;

            //option: focus vào dòng đã sửa
            if (!m_blFlag)
            {
                fgQD.Row = fgRow;
            }
        }