Beispiel #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int id;
            if (string.IsNullOrEmpty(txtID.Text))
            {
                MessageBox.Show("Chưa chọn quy định");
                return;
            }
            string maquydinh, noidung;
            id = Int32.Parse(txtID.Text.Trim());
            maquydinh = txtMaQD.Text.Trim();
            noidung = txtNoiDung.Text.Trim();
            QuyDinh qd = new QuyDinh(id, maquydinh, noidung);
            try
            {
                int i = new QuyDinhBUS().ThayDoiQuyDinh(qd);
                if (i == -2)
                {
                    MessageBox.Show("Chưa chọn thông tin");
                }
            }
            catch (Exception)
            {

            }
            MessageBox.Show("Thay đổi thành công");
            dgrQuyDinh.DataSource = qdbus.getQuyDinh();
        }
Beispiel #2
0
 public List <QuyDinh> getQuyDinh()
 {
     try
     {
         string         sql = "select * from QuyDinh";
         SqlDataReader  dr = dp.myExecuteReader(sql);
         List <QuyDinh> list = new List <QuyDinh>();
         string         maQuyDinh, thongTin;
         int            id;
         while (dr.Read())
         {
             id        = dr.GetInt32(0);
             maQuyDinh = dr.GetString(1);
             thongTin  = dr.GetString(2);
             QuyDinh qd = new QuyDinh(id, maQuyDinh, thongTin);
             list.Add(qd);
         }
         return(list);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
     finally
     {
         dp.DisConnect();
     }
 }
Beispiel #3
0
        private const int TimeToRefresh_Download = 600000; // 10 min

        private async Task RefreshUploadAsync()
        {
            while (true)
            {
                try
                {
                    await Task.Delay(TimeToRefresh_Upload);

                    DB.ChangeTracker.DetectChanges();
                    if (DB.ChangeTracker.HasChanges())
                    {
                        var setting = DB.QuyDinh.Find("LastUpdated");
                        // TODO: remove this
                        //*
                        if (setting == null)
                        {
                            setting = new QuyDinh {
                                MaQuyDinh = "LastUpdated"
                            };
                            DB.QuyDinh.Add(setting);
                        }
                        //*/
                        setting.GiaTri = DateTime.Now.ToString();
                    }
                    DB.SaveChanges();
                }
                catch (Exception e) { Console.WriteLine(e.ToString()); }
            }
        }
 public NhapThongTinChuyenBay()
 {
     InitializeComponent();
     quanlyBUS  = new QuanlysanbayvatuyenbayBUS();
     quydinhBUS = new QuyDinhBUS();
     QuyDinh    = quydinhBUS.LayDanhSachQuyDinh();
 }
 /// <summary>
 /// thêm thông tin quy định vào database
 /// </summary>
 public static void AddQuyDinh(QuyDinh QuyDinh)
 {
     using (var db = new LiteDatabase(DatabaseConnectionString))
     {
         db.GetCollection <QuyDinh>("QuyDinh").Insert(QuyDinh);
     }
 }
        public void XoaQuyDinh(int _IDQuyDinh)
        {
            QuyDinh _QuyDinh = dbContext.QuyDinhs.Single <QuyDinh>(x => x.id_quydinh == _IDQuyDinh);

            dbContext.QuyDinhs.DeleteOnSubmit(_QuyDinh);

            dbContext.SubmitChanges();
        }
Beispiel #7
0
        public Boolean delete(QuyDinh quyDinh)
        {
            String query = "delete from QuyDinh where MaQuyDinh = @MaQuyDinh";
            List <SqlParameter> sqlParameters = new List <SqlParameter>();
            SqlParameter        parameter     = new SqlParameter("MaQuyDinh", quyDinh.MaQuyDinh);

            sqlParameters.Add(parameter);
            return(this.dp.ExecuteNonQuery(query, sqlParameters));
        }
        void loadQD()
        {
            QuyDinh qd = QuyDinhDAO.loadQuyDinh();

            txtLuongSach.Text = qd.NhapToiThieu;
            txtNo.Text        = qd.KHNoToiThieu.ToString("###,###,###' 'VNĐ");
            txtTon1.Text      = qd.TonNhapToiThieu;
            txtTon2.Text      = qd.TonBanToiThieu;
        }
Beispiel #9
0
        /// <summary>
        /// cập nhật thông tin quy định vào database
        /// </summary>
        public static bool SetDocGia(QuyDinh QuyDinh)
        {
            bool result;

            using (var db = new LiteDatabase(DatabasePath)) {
                result = db.GetCollection <QuyDinh>("QuyDinh").Update(QuyDinh);
            }
            return(result);
        }
        /// <summary>
        /// cập nhật thông tin quy định vào database
        /// </summary>
        public static bool SetQuyDinh(QuyDinh QuyDinh)
        {
            bool result;

            using (var db = new LiteDatabase(DatabaseConnectionString))
            {
                result = db.GetCollection <QuyDinh>("QuyDinh").Update(QuyDinh);
            }
            return(result);
        }
        public static void UpdateQuyDinh(string luongsach, int KHno, string tonNhap, string tonBan)
        {
            dbMainDataContext dbMain = new dbMainDataContext();
            QuyDinh           qd     = dbMain.QuyDinhs.Where(p => p.MaQuyDinh == "1").FirstOrDefault();

            qd.NhapToiThieu    = luongsach;
            qd.KHNoToiThieu    = KHno;
            qd.TonBanToiThieu  = tonBan;
            qd.TonNhapToiThieu = tonNhap;
            dbMain.SubmitChanges();
        }
        public void CapNhatQuyDinh(QuyDinh m)
        {
            QuyDinh _qd = dbContext.QuyDinhs.Single <QuyDinh>(x => x.id_quydinh == m.id_quydinh);

            _qd.tenquydinh = m.tenquydinh;
            _qd.NhanVien   = dbContext.NhanViens.Single <NhanVien>(l => l.id_nhanvien == m.id_nhanvien);
            _qd.ngaylap    = m.ngaylap;
            _qd.noidung    = m.noidung;
            // update
            dbContext.SubmitChanges();
        }
Beispiel #13
0
 public int ThayDoiQuyDinh(QuyDinh qd)
 {
     try
     {
         return(_qdDAO.ThayDoiQuyDinh(qd));
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #14
0
 public IActionResult Post3(string id)
 {
     try{
         QuyDinh del = _db.QuyDinh.FirstOrDefault(x => x.SoQuyDinh == id);
         del.TrangThai = false;
         _db.SaveChanges();
         return(Ok("Xoa thanh cong"));
     }
     catch {
         return(BadRequest());
     }
 }
 public IActionResult Getcv(string id)
 {
     try
     {
         QuyDinh model = _db.QuyDinh.Find(id);
         return(Ok(model));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
 public void ThemQuyDinh(QuyDinh quydinh)
 {
     try
     {
         dbContext.QuyDinhs.InsertOnSubmit(quydinh);
         dbContext.SubmitChanges();
     }
     catch (Exception)
     {
         Notifications.Answers("Bạn hãy kiểm tra lại, tên quy định không được trùng nhau.");
     }
 }
Beispiel #17
0
        public static void ThayDoiQuyDinh(QuyDinh quyDinh)
        {
            DataAccessHelper db  = new DataAccessHelper();
            SqlCommand       cmd = db.Command("TDSLXE");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@SOXESUACHUATOIDA", quyDinh.SoXeSuaChuaToiDa);

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            db.dt = new DataTable();
            da.Fill(db.dt);
        }
Beispiel #18
0
        public Boolean insert(QuyDinh quyDinh)
        {
            String query = "insert into QuyDinh(TenQuyDinh,GiaTri) values(@TenQuyDinh, @GiaTri)";
            List <SqlParameter> sqlParameters = new List <SqlParameter>();

            SqlParameter param_TenQuyDinh = new SqlParameter("TenQuyDinh", quyDinh.TenQuyDinh);
            SqlParameter param_GiaTri     = new SqlParameter("GiaTri", quyDinh.TenQuyDinh);

            sqlParameters.Add(param_TenQuyDinh);
            sqlParameters.Add(param_GiaTri);

            return(this.dp.ExecuteNonQuery(query, sqlParameters));
        }
Beispiel #19
0
 private void btn_Luu_Click(object sender, EventArgs e)
 {
     if (kt == "Them")
     {
         QuyDinh qd = new QuyDinh();
         qd.tenquydinh  = txt_TenQuyDinh.Text;
         qd.id_nhanvien = (int)cmb_NhanVienLap.EditValue;
         qd.ngaylap     = dt_NgayLap.DateTime;
         qd.noidung     = rxt_NoiDung.Text;
         if (KiemTraLuu() == true)
         {
             _quydinhBLL.ThemQuyDinh(qd);
             Notifications.Answers("Thêm thành công!");
             ReLoadQuyDinh();
             LoadDataSource();
         }
         else
         {
             if (txt_MaQuyDinh.Text != "")
             {
                 QuyDinh qd1 = new QuyDinh();
                 qd1.id_quydinh  = int.Parse(txt_MaQuyDinh.Text);
                 qd1.tenquydinh  = txt_TenQuyDinh.Text;
                 qd1.id_nhanvien = (int)cmb_NhanVienLap.EditValue;
                 qd1.ngaylap     = dt_NgayLap.DateTime;
                 qd1.noidung     = rxt_NoiDung.Text;
                 _quydinhBLL.CapNhatQuyDinh(qd1);
                 Notifications.Answers("Sửa thành công!");
                 LoadDataSource();
             }
             else
             {
                 Notifications.Answers("Quy định đã có trong danh sách!");
             }
         }
     }
     else
     if (kt == "Sua")
     {
         QuyDinh qd = new QuyDinh();
         qd.id_quydinh  = int.Parse(txt_MaQuyDinh.Text);
         qd.tenquydinh  = txt_TenQuyDinh.Text;
         qd.id_nhanvien = (int)cmb_NhanVienLap.EditValue;
         qd.ngaylap     = dt_NgayLap.DateTime;
         qd.noidung     = rxt_NoiDung.Text;
         _quydinhBLL.CapNhatQuyDinh(qd);
         Notifications.Answers("Sửa thành công!");
         LoadDataSource();
     }
 }
Beispiel #20
0
        public Boolean update(QuyDinh quyDinh)
        {
            String query = "update QuyDinh set GiaTri = @GiaTri where MaQuyDinh = @MaQuyDinh";
            List <SqlParameter> sqlParameters = new List <SqlParameter>();

            SqlParameter param_GiaTri = new SqlParameter("GiaTri", quyDinh.GiaTri);

            sqlParameters.Add(param_GiaTri);
            SqlParameter param_MaQuyDinh = new SqlParameter("MaQuyDinh", quyDinh.MaQuyDinh);

            sqlParameters.Add(param_MaQuyDinh);

            return(this.dp.ExecuteNonQuery(query, sqlParameters));
        }
Beispiel #21
0
        public async Task <QuyDinh> Create(QuyDinhForCreateDto quyDinh)
        {
            var danhSachQuyDinh = await _context.DanhSachQuyDinh.OrderByDescending(x => x.MaQuyDinh).FirstOrDefaultAsync();

            var maQuyDinh = 0;

            if (danhSachQuyDinh == null)
            {
                maQuyDinh = 0;
            }
            else
            {
                maQuyDinh = danhSachQuyDinh.MaQuyDinh + 1;
            }

            var newQuyDinh = new QuyDinh();

            newQuyDinh.MaQuyDinh             = maQuyDinh;
            newQuyDinh.TenQuyDinh            = quyDinh.TenQuyDinh;
            newQuyDinh.ThoiGianBatDauHieuLuc = quyDinh.ThoiGianBatDauHieuLuc;
            newQuyDinh.SoSVTHToiThieu        = quyDinh.SoSVTHToiThieu;
            newQuyDinh.SoSVTHToiDa           = quyDinh.SoSVTHToiDa;
            newQuyDinh.SoGVHDToiThieu        = quyDinh.SoGVHDToiThieu;
            newQuyDinh.SoGVHDToiDa           = quyDinh.SoGVHDToiDa;
            newQuyDinh.SoGVPBToiThieu        = quyDinh.SoGVPBToiThieu;
            newQuyDinh.SoGVPBToiDa           = quyDinh.SoGVPBToiDa;
            newQuyDinh.SoTVHDToiThieu        = quyDinh.SoTVHDToiThieu;
            newQuyDinh.SoTVHDToiDa           = quyDinh.SoTVHDToiDa;
            newQuyDinh.SoCTHDToiThieu        = quyDinh.SoCTHDToiThieu;
            newQuyDinh.SoCTHDToiDa           = quyDinh.SoCTHDToiDa;
            newQuyDinh.SoTKHDToiThieu        = quyDinh.SoTKHDToiThieu;
            newQuyDinh.SoTKHDToiDa           = quyDinh.SoTKHDToiDa;
            newQuyDinh.SoUVHDToiThieu        = quyDinh.SoUVHDToiThieu;
            newQuyDinh.SoUVHDToiDa           = quyDinh.SoUVHDToiDa;
            newQuyDinh.SoChuSoThapPhan       = quyDinh.SoChuSoThapPhan;
            newQuyDinh.DiemSoToiThieu        = quyDinh.DiemSoToiThieu;
            newQuyDinh.DiemSoToiDa           = quyDinh.DiemSoToiDa;
            newQuyDinh.HeSoGVHD        = quyDinh.HeSoGVHD;
            newQuyDinh.HeSoGVPB        = quyDinh.HeSoGVPB;
            newQuyDinh.HeSoTVHD        = quyDinh.HeSoTVHD;
            newQuyDinh.ThoiGianTao     = DateTime.Now;
            newQuyDinh.ThoiGianCapNhat = DateTime.Now;
            newQuyDinh.TrangThai       = 1;

            await _context.DanhSachQuyDinh.AddAsync(newQuyDinh);

            await _context.SaveChangesAsync();

            return(newQuyDinh);
        }
Beispiel #22
0
 public IActionResult Post2([FromBody] QuyDinh cb, string id)
 {
     try{
         QuyDinh edit = _db.QuyDinh.FirstOrDefault(x => x.SoQuyDinh == id);
         edit.MaNamHoc       = cb.MaNamHoc;
         edit.NoiDungQuyDinh = cb.NoiDungQuyDinh;
         edit.NgayBanHanh    = cb.NgayBanHanh;
         _db.SaveChanges();
         return(Ok("Them thanh cong"));
     }
     catch {
         return(BadRequest());
     }
 }
        private void frptDanhSachHocSinh_Load(object sender, EventArgs e)
        {
            IList <ReportParameter> param            = new List <ReportParameter>();
            QuyDinhInfo             m_ThongTinTruong = QuyDinh.LayThongTinTruong();

            param.Add(new ReportParameter("TenTruong", m_ThongTinTruong.TenTruong));
            param.Add(new ReportParameter("DiaChiTruong", m_ThongTinTruong.DiaChiTruong));
            param.Add(new ReportParameter("NgayLap", DateTime.Today.Day + "/" + DateTime.Today.Month + "/" + DateTime.Today.Year));
            this.reportViewerDSHS.LocalReport.SetParameters(param);

            IList <HocSinhInfo> hocsinh = HocSinhCtrl.LayDsHocSinh();

            this.bSDSHocSinh.DataSource = hocsinh;

            this.reportViewerDSHS.RefreshReport();
        }
Beispiel #24
0
        public int ThayDoiQuyDinh(QuyDinh qd)
        {
            List <SqlParameter> list = new List <SqlParameter>();

            list.Add(new SqlParameter("@id", qd.Id));
            list.Add(new SqlParameter("@maquydinh", qd.MaQuyDinh));
            list.Add(new SqlParameter("@thongtin", qd.ThongTin));
            try
            {
                return(ExecProcedure("ThayDoiQuyDinh", System.Data.CommandType.StoredProcedure, list));
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
        private void btnXemTatCa_Click(object sender, EventArgs e)
        {
            IList <LopInfo> lop = LopCtrl.LayDsLop();

            IList <ReportParameter> param            = new List <ReportParameter>();
            QuyDinhInfo             m_ThongTinTruong = QuyDinh.LayThongTinTruong();

            param.Add(new ReportParameter("TenTruong", m_ThongTinTruong.TenTruong));
            param.Add(new ReportParameter("DiaChiTruong", m_ThongTinTruong.DiaChiTruong));
            param.Add(new ReportParameter("NgayLap", DateTime.Today.Day + "/" + DateTime.Today.Month + "/" + DateTime.Today.Year));
            param.Add(new ReportParameter("NamHoc", "Tất cả"));
            this.reportViewerDSLop.LocalReport.SetParameters(param);

            this.bSDSLop.DataSource = lop;
            this.reportViewerDSLop.RefreshReport();
        }
        private void frptDanhSachGiaoVien_Load(object sender, EventArgs e)
        {
            IList <ReportParameter> param            = new List <ReportParameter>();
            QuyDinhInfo             m_ThongTinTruong = QuyDinh.LayThongTinTruong();

            param.Add(new ReportParameter("TenTruong", m_ThongTinTruong.TenTruong));
            param.Add(new ReportParameter("DiaChiTruong", m_ThongTinTruong.DiaChiTruong));
            param.Add(new ReportParameter("NgayLap", DateTime.Today.Day + "/" + DateTime.Today.Month + "/" + DateTime.Today.Year));
            this.reportViewerDSGV.LocalReport.SetParameters(param);

            IList <GiaoVienInfo> giaovien = GiaoVienCtrl.LayDsGiaoVien();

            this.bSDSGiaoVien.DataSource = giaovien;

            this.reportViewerDSGV.RefreshReport();
        }
Beispiel #27
0
        public async Task <ICollection <QuyDinh> > CreateMultiple(ICollection <QuyDinhForCreateMultipleDto> danhSachQuyDinh)
        {
            ICollection <QuyDinh> temp = new List <QuyDinh>();

            for (int i = 0; i < danhSachQuyDinh.Count; i++)
            {
                var quyDinh = danhSachQuyDinh.ElementAt(i);

                var newQuyDinh = new QuyDinh();
                newQuyDinh.MaQuyDinh             = quyDinh.MaQuyDinh;
                newQuyDinh.TenQuyDinh            = quyDinh.TenQuyDinh;
                newQuyDinh.ThoiGianBatDauHieuLuc = quyDinh.ThoiGianBatDauHieuLuc;
                newQuyDinh.SoSVTHToiThieu        = quyDinh.SoSVTHToiThieu;
                newQuyDinh.SoSVTHToiDa           = quyDinh.SoSVTHToiDa;
                newQuyDinh.SoGVHDToiThieu        = quyDinh.SoGVHDToiThieu;
                newQuyDinh.SoGVHDToiDa           = quyDinh.SoGVHDToiDa;
                newQuyDinh.SoGVPBToiThieu        = quyDinh.SoGVPBToiThieu;
                newQuyDinh.SoGVPBToiDa           = quyDinh.SoGVPBToiDa;
                newQuyDinh.SoTVHDToiThieu        = quyDinh.SoTVHDToiThieu;
                newQuyDinh.SoTVHDToiDa           = quyDinh.SoTVHDToiDa;
                newQuyDinh.SoCTHDToiThieu        = quyDinh.SoCTHDToiThieu;
                newQuyDinh.SoCTHDToiDa           = quyDinh.SoCTHDToiDa;
                newQuyDinh.SoTKHDToiThieu        = quyDinh.SoTKHDToiThieu;
                newQuyDinh.SoTKHDToiDa           = quyDinh.SoTKHDToiDa;
                newQuyDinh.SoUVHDToiThieu        = quyDinh.SoUVHDToiThieu;
                newQuyDinh.SoUVHDToiDa           = quyDinh.SoUVHDToiDa;
                newQuyDinh.SoChuSoThapPhan       = quyDinh.SoChuSoThapPhan;
                newQuyDinh.DiemSoToiThieu        = quyDinh.DiemSoToiThieu;
                newQuyDinh.DiemSoToiDa           = quyDinh.DiemSoToiDa;
                newQuyDinh.HeSoGVHD        = quyDinh.HeSoGVHD;
                newQuyDinh.HeSoGVPB        = quyDinh.HeSoGVPB;
                newQuyDinh.HeSoTVHD        = quyDinh.HeSoTVHD;
                newQuyDinh.ThoiGianTao     = DateTime.Now;
                newQuyDinh.ThoiGianCapNhat = DateTime.Now;
                newQuyDinh.TrangThai       = 1;



                temp.Add(newQuyDinh);

                await _context.DanhSachQuyDinh.AddAsync(newQuyDinh);

                await _context.SaveChangesAsync();
            }

            return(temp);
        }
 public bool ThemQuyDinh(string tenquydinh, string noidung)
 {
     try
     {
         QuyDinh qd = new QuyDinh();
         qd.TenQuyDinh = tenquydinh;
         qd.NoiDung    = noidung;
         QUANLYNHATRO1DataContext context = new QUANLYNHATRO1DataContext();
         context.QuyDinhs.InsertOnSubmit(qd);
         context.SubmitChanges();
         return(true);
     }
     catch
     {
     }
     return(false);
 }
        public static QuyDinh GetQD()
        {
            QuyDinh qd = new QuyDinh();

            using (dbMainDataContext dbMain = new dbMainDataContext())
            {
                var query = from p in dbMain.QuyDinhs where p.MaQuyDinh == "1" select p;
                foreach (var row in query)
                {
                    qd.KHNoToiThieu    = row.KHNoToiThieu;
                    qd.NhapToiThieu    = row.NhapToiThieu;
                    qd.TonBanToiThieu  = row.TonBanToiThieu;
                    qd.TonNhapToiThieu = row.TonNhapToiThieu;
                }
            }
            return(qd);
        }
Beispiel #30
0
        private void frmQuyDinh_Load(object sender, EventArgs e)
        {
            gridQD.AutoGenerateColumns = false;
            List <QUYDINH> source = QuyDinh.SelectAll();

            foreach (var i in source)
            {
                gridQD.Rows.Add(new string[]
                {
                    i.MaQD,
                    i.TenQD,
                    i.GiaTri.ToString()
                });
            }

            gridQD_Click(sender, e);
        }