Beispiel #1
0
        private void btnMoPhieu_Click(object sender, EventArgs e)
        {
            try
            {
                if (grvDanhSach.FocusedRowHandle < 0)
                {
                    return;
                }

                var item = (ChungTuXuatTieuHaoInfornew)grvDanhSach.GetFocusedRow();

                if (CommonProvider.Instance.Lock_ChungTu(item))
                {
                    var frm = new frm_PhieuXuatTieuHaoNew(
                        item.IdChungTu, item.SoChungTu, item.NgayXuatHang.ToString(),
                        item.SoChungTuGoc, item.IdChungTuGoc, item.TrangThai,
                        item.HoTen, item.TenTrungTam, item.TenKho, item.NguoiXuat,
                        item.GhiChu, item.IdNhanVienGiao, item.NgayLap.ToString(),
                        item.IdKho);

                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        liDM = XuatTieuHaoProvidernew.GetListXuatTieuHao();

                        grcDanhSach.DataSource = liDM;
                    }
                    CommonProvider.Instance.UnLock_ChungTu(item);
                }
                else
                {
                    throw new ManagedException("Chứng từ đã bị lock bởi người dùng khác!");
                }
            }
            catch (ManagedException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show(ex.ToString());
#else
                MessageBox.Show(ex.Message);

                EventLogProvider.Instance.WriteOfflineLog(ex.ToString(), "Danh sách xuất tiêu hao");
#endif
            }
        }
Beispiel #2
0
        private void grvDanhSach_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (grvDanhSach.FocusedRowHandle < 0)
                {
                    return;
                }
                var item = (ChungTuXuatTieuHaoInfornew)grvDanhSach.GetFocusedRow();
                if (item == null)
                {
                    return;
                }
                if (CommonProvider.Instance.Lock_ChungTu(item))
                {
                    var frm = new frm_PhieuXuatTieuHaoNew(item.IdChungTu, item.SoChungTu, item.NgayXuatHang.ToString(),
                                                          item.SoChungTuGoc, item.IdChungTuGoc, item.TrangThai, item.HoTen, item.TenTrungTam, item.TenKho, item.NguoiXuat,
                                                          item.GhiChu, item.IdNhanVienGiao, item.NgayLap.ToString(), item.IdKho);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        liDM = XuatTieuHaoProvidernew.GetListXuatTieuHao();
                        grcDanhSach.DataSource = liDM;
                    }

                    CommonProvider.Instance.UnLock_ChungTu(item);
                }
                else
                {
                    throw new ManagedException("Chứng từ đã bị lock bởi người dùng khác!");
                }
            }
            catch (ManagedException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show(ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                MessageBox.Show(ex.Message, Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
                EventLogProvider.Instance.WriteLog(ex.ToString()
                                                   + "\nUser: "******"\nKho: " + Declare.IdKho,
                                                   this.Name);
            }
        }