Esempio n. 1
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            DataTable numberr;

            _dttb = new DTO_ThietBi()
            {
                ID_INF_MAC = cls_Main._Luachon
            };
            if (cbtinhtrang.SelectedIndex == 1)
            {
                numberr = _tbb.ThietBiKhongHoatDong(ref err, _dttb, 0);
                if (numberr.Rows.Count > 0)
                {
                    var thietbi = new ThietBi();
                    cls_Main.LoadUserControl2(cls_Controls._pn_Hienthi, thietbi);
                    thietbi.ThietBiSelectOld();
                }
            }
            else
            {
                numberr = _tbb.ThietBiKhongHoatDong(ref err, _dttb, 1);
                if (numberr.Rows.Count > 0)
                {
                    var thietbi = new ThietBi();
                    cls_Main.LoadUserControl2(cls_Controls._pn_Hienthi, thietbi);
                    thietbi.ThietBiSelectOld();
                }
            }
        }
Esempio n. 2
0
        public bool KiemTraHoatDong()
        {
            _dttb = new DTO_ThietBi()
            {
                ID_INF_MAC = cls_Main._Luachon
            };
            numberr = _tbb.TinhTrangThietBi(ref err, _dttb);
            if (numberr.Rows.Count > 0)
            {
                if (Convert.ToInt32(numberr.Rows[0]["NOW_STATUS"]) == 1)
                {
                    ToastNotification.Show(this, "Thiết bị phải được ghi nhận tình trạng trước khi sửa!", null, 2000, (eToastGlowColor)eToastGlowColor.Blue, (eToastPosition)eToastPosition.TopCenter);
                    txtloaithietbi.Enabled      = false;
                    txtlop.Enabled              = false;
                    txtlydohong.Enabled         = false;
                    txttenthietbi.Enabled       = false;
                    txttinhtranghientai.Enabled = false;
                    btnLuu.Enabled              = false;
                    btnHuy.Enabled              = false;
                    btntrathietbi.Enabled       = false;
                    dtngaysua.Enabled           = false;
                    cbgiaovien.Enabled          = false;
                    cblichgv.Enabled            = false;
                    cbnhanvien.Enabled          = false;
                    lblchuyentrang.Visible      = false;

                    return(true);
                }
            }
            return(false);
        }
Esempio n. 3
0
        public DataTable MuonThietBi(ref string err, DTO_ThietBi tb)
        {
            DataTable _dt = new DataTable();

            try
            {
                return(_dt = data.GetDataTable("sp_ThueThietBi", CommandType.StoredProcedure, ref err
                                               , new SqlParameter("@STT", tb.STT)

                                               , new SqlParameter("@STT_CALEN", tb.ID_CALEN)
                                               , new SqlParameter("@ID_INF_MAC", tb.ID_INF_MAC)
                                               , new SqlParameter("@ID_STATUS", tb.ID_STATUS)
                                               , new SqlParameter("@ID_TEACHER", tb.ID_TEACHER)
                                               , new SqlParameter("@DATE_TIME", tb.DATE_TIME)
                                               , new SqlParameter("@REASON_RENT", tb.REASON_RENT)
                                               , new SqlParameter("@DATE_RENT", tb.DATE_RENT)

                                               ));
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(_dt);
            }
        }
Esempio n. 4
0
 public bool KiemTra()
 {
     _dttb = new DTO_ThietBi()
     {
         ID_INF_MAC = cls_Main._Luachon
     };
     numberr = _tbb.ThietBiDangMuon(ref err, _dttb);
     if (numberr.Rows.Count > 0)
     {
         if (numberr.Rows[0]["ErrCode"].ToString() == "1")
         {
             ToastNotification.Show(this, "Thiết bị phải được trã trước khi ghi nhận sửa chữa!", null, 2000, (eToastGlowColor)eToastGlowColor.Blue, (eToastPosition)eToastPosition.TopCenter);
             txtloaithietbi.Enabled      = false;
             txtlop.Enabled              = false;
             txtlydohong.Enabled         = false;
             txttenthietbi.Enabled       = false;
             txttinhtranghientai.Enabled = false;
             btnLuu.Enabled              = false;
             btnHuy.Enabled              = false;
             btntrathietbi.Enabled       = false;
             dtngaysua.Enabled           = false;
             cbgiaovien.Enabled          = false;
             cblichgv.Enabled            = false;
             cbnhanvien.Enabled          = false;
             lblchuyentrang.Visible      = true;
             tchuyen.Enabled             = true;
             circularProgress1.Visible   = true;
             circularProgress1.IsRunning = true;
             return(true);
         }
     }
     return(false);
 }
Esempio n. 5
0
        public void MuonThietBi()
        {
            DataTable numberr;

            _dttb = new DTO_ThietBi()
            {
                STT         = GetMaxID() + 1,
                ID_CALEN    = Convert.ToInt32(cblichgv.SelectedValue),
                ID_INF_MAC  = cls_Main._Id_inf_mac,
                ID_STATUS   = 3,
                ID_TEACHER  = Convert.ToInt32(cbnhanvien.SelectedValue),
                DATE_TIME   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                REASON_RENT = txtlydomuon.Text.Trim(),
                DATE_RENT   = dtngaymuon.Value.ToString("yyyy-MM-dd HH:mm:ss")
            };

            numberr = _tbb.MuonThietBi(ref err, _dttb);
            if (numberr.Rows.Count > 0)
            {
                var thietbi = new ThietBi();

                cls_Main.LoadUserControl2(cls_Controls._pn_Hienthi, thietbi);
                thietbi.ThietBiSelectOld();
            }
        }
Esempio n. 6
0
        public static DTO_ThietBi layThietBi(int ID)
        {
            DataTable   dt = tim(ID);
            DTO_ThietBi TB = new DTO_ThietBi();

            TB.THIETBI_MATB       = ID;
            TB.THIETBI_TEN        = dt.Rows[0]["ten"].ToString();
            TB.THIETBI_GIA        = (int)dt.Rows[0]["gia"];
            TB.THIETBI_SOLUONG    = (int)dt.Rows[0]["soluong"];
            TB.THIETBI_THONGTINCT = dt.Rows[0]["thongtinct"].ToString();
            TB.THIETBI_TENLOAI    = dt.Rows[0]["tenloai"].ToString();
            return(TB);
        }
Esempio n. 7
0
        public DataTable ThietBiKhongHoatDong(ref string err, DTO_ThietBi tb, int a)
        {
            DataTable _dt = new DataTable();

            try
            {
                return(_dt = data.GetDataTable("sp_ThietBiKhonghd", CommandType.StoredProcedure, ref err
                                               , new SqlParameter("@ID_INF_MAC", tb.ID_INF_MAC)
                                               , new SqlParameter("@a", a)
                                               ));
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(_dt);
            }
        }
Esempio n. 8
0
        public DataTable TinhTrangThietBi(ref string err, DTO_ThietBi tb)
        {
            DataTable _dt = new DataTable();

            try
            {
                return(_dt = data.GetDataTable("sp_spKiemTraTinhTrangThietBi", CommandType.StoredProcedure, ref err
                                               , new SqlParameter("@ID_INF_MAC", tb.ID_INF_MAC)

                                               ));
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(_dt);
            }
        }
Esempio n. 9
0
        public void ThemThietBi()
        {
            DataTable numberr;

            dt_thietbi = new DTO_ThietBi()
            {
                ID_INF        = Convert.ToInt32(cboLoaitb.SelectedValue),
                NAMES_INF_MAC = txttentb.Text,
                DAY_INF_MAC   = cbdatengaytb.Value.ToString("yyyy-MM-dd"),
                IM_MACHINE    = txtghichu.Text
            };

            numberr = _db.ThietBiInsert(ref err, dt_thietbi);
            if (numberr.Rows.Count > 0)
            {
                ToastNotification.Show(this, numberr.Rows[0]["ErrMsg"].ToString(), null, 2000, (eToastGlowColor)eToastGlowColor.Blue, (eToastPosition)eToastPosition.BottomCenter);
            }
        }
Esempio n. 10
0
        public DataTable TraThietBi_Tra(ref string err, DTO_ThietBi tb)
        {
            DataTable _dt = new DataTable();

            try
            {
                return(_dt = data.GetDataTable("sp_TraThietBi_Hong", CommandType.StoredProcedure, ref err
                                               , new SqlParameter("@_DATE_FIX_COMPLETE", tb.DATE_RENT)
                                               , new SqlParameter("@STT", tb.STT)
                                               , new SqlParameter("@ID_INF_MAC", tb.ID_INF_MAC)
                                               ));
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(_dt);
            }
        }
Esempio n. 11
0
        public void KiemTra()
        {
            DataTable dtdangsua = new DataTable();

            _dttb = new DTO_ThietBi()
            {
                ID_INF_MAC = cls_Main._Luachon
            };
            numberr   = _tbb.ThietBiDangMuon(ref err, _dttb);
            dtdangsua = _tbb.TinhTrangThietBi(ref err, _dttb);
            if (numberr.Rows.Count > 0)
            {
                if (numberr.Rows[0]["ErrCode"].ToString() == "1")
                {
                    ToastNotification.Show(this, "Thiết bị phải được trã trước khi ghi nhận là không hoạt động!", null, 2000, (eToastGlowColor)eToastGlowColor.Blue, (eToastPosition)eToastPosition.TopCenter);
                    cbtinhtrang.Enabled         = false;
                    btnLuu.Enabled              = false;
                    lblchuyentrang.Visible      = true;
                    tchuyen.Enabled             = true;
                    circularProgress1.Visible   = true;
                    circularProgress1.IsRunning = true;
                    return;
                }
                else
                {
                    cbtinhtrang.Enabled = true;
                    btnLuu.Enabled      = true;
                }
            }
            if (dtdangsua.Rows.Count > 0)
            {
                if (dtdangsua.Rows[0]["FIX_STATUS"].ToString() == "4")
                {
                    ToastNotification.Show(this, "Thiết bị này chưa được sửa chữa hoàn tất.!", null, 2000, (eToastGlowColor)eToastGlowColor.Blue, (eToastPosition)eToastPosition.TopCenter);
                    cbtinhtrang.Enabled         = false;
                    btnLuu.Enabled              = false;
                    lblchuyentrang.Visible      = true;
                    _timersuachua.Enabled       = true;
                    circularProgress1.Visible   = true;
                    circularProgress1.IsRunning = true;
                    return;
                }
            }
        }
Esempio n. 12
0
        public void TraThietBi()
        {
            DataTable numberr;

            _dttb = new DTO_ThietBi()
            {
                STT        = GetSTT(cls_Main._Id_inf_mac),
                DATE_RENT  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                ID_INF_MAC = cls_Main._Id_inf_mac
            };

            numberr = _tbb.TraThietBi(ref err, _dttb);


            var thietbi = new ThietBi();

            cls_Main.LoadUserControl2(cls_Controls._pn_Hienthi, thietbi);
            thietbi.ThietBiSelectOld();
        }
Esempio n. 13
0
        public DataTable ThietBiInsert(ref string err, DTO_ThietBi ltb)
        {
            DataTable _dt = new DataTable();

            try
            {
                return(_dt = data.GetDataTable("sp_ThietBiInsert", CommandType.StoredProcedure, ref err
                                               , new SqlParameter("@ID_INF", ltb.ID_INF)
                                               , new SqlParameter("@NAMES_INF_MAC", ltb.NAMES_INF_MAC)
                                               , new SqlParameter("@DAY_INF_MAC", ltb.DAY_INF_MAC)
                                               , new SqlParameter("@IM_MACHINE", ltb.IM_MACHINE)

                                               ));
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(_dt);
            }
        }
Esempio n. 14
0
        public DataTable HongThietBi(ref string err, DTO_ThietBi tb)
        {
            DataTable _dt = new DataTable();

            try
            {
                return(_dt = data.GetDataTable("sp_BaoHongThietBi", CommandType.StoredProcedure, ref err
                                               , new SqlParameter("@STT", tb.STT)
                                               , new SqlParameter("@STT_CALEN", tb.ID_CALEN)
                                               , new SqlParameter("@ID_INF_MAC", tb.ID_INF_MAC)
                                               , new SqlParameter("@DATE", tb.DATE_TIME)
                                               , new SqlParameter("@DATE_FIX", tb.DATE_FIX)
                                               , new SqlParameter("@_REASON_FIX", tb.REASON_FIX)
                                               , new SqlParameter("@_REASON_ERROR", tb.REASON_ERROR)

                                               ));
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(_dt);
            }
        }
Esempio n. 15
0
        public void HongThietBi()
        {
            DataTable numberr;

            _dttb = new DTO_ThietBi()
            {
                STT          = GetMaxID() + 1,
                ID_CALEN     = Convert.ToInt32(cblichgv.SelectedValue),
                ID_INF_MAC   = cls_Main._Id_inf_mac,
                DATE_TIME    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                DATE_FIX     = dtngaysua.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                REASON_FIX   = txttinhtranghientai.Text.Trim(),
                REASON_ERROR = txtlydohong.Text.Trim()
            };

            numberr = _tbb.HongThietBi(ref err, _dttb);
            if (numberr.Rows.Count > 0)
            {
                var thietbi = new ThietBi();

                cls_Main.LoadUserControl2(cls_Controls._pn_Hienthi, thietbi);
                thietbi.ThietBiSelectOld();
            }
        }
Esempio n. 16
0
 public static bool sua(DTO_ThietBi TB)
 {
     DAL.DAL_ThietBi DALTB = new DAL.DAL_ThietBi();
     return(DALTB.sua(TB));
 }
Esempio n. 17
0
 public static bool them(DTO_ThietBi TB)
 {
     DAL.DAL_ThietBi DALTB = new DAL.DAL_ThietBi();
     return(DALTB.them(TB));
 }