Ejemplo n.º 1
0
        public HoSo getHoSo(int ID)
        {
            HoSo      result = null;
            string    query  = "SELECT * FROM Su_HoSo WHERE ID = " + ID + "";
            DataTable dt     = getData(query);

            if (dt.Rows.Count > 0)
            {
                result                 = new HoSo();
                result.ID              = ID;
                result.Coquan          = dt.Rows[0]["Coquan"].ToString();
                result.MaPhong         = dt.Rows[0]["MaPhong"].ToString();
                result.MucLucSo        = dt.Rows[0]["MucLucSo"].ToString();
                result.HopSo           = dt.Rows[0]["HopSo"].ToString();
                result.HoSoSo          = dt.Rows[0]["HoSoSo"].ToString();
                result.NgonNgu         = dt.Rows[0]["NgonNgu"].ToString();
                result.KyHieu          = dt.Rows[0]["KyHieu"].ToString();
                result.TieuDe          = dt.Rows[0]["TieuDe"].ToString();
                result.GhiChu          = dt.Rows[0]["GhiChu"].ToString();
                result.ThoiGianBatDau  = dt.Rows[0]["ThoiGianBatDau"].ToString();
                result.ThoiGianKetThuc = dt.Rows[0]["ThoiGianKetThuc"].ToString();
                result.ButTich         = dt.Rows[0]["ButTich"].ToString();
                result.SoLuong         = dt.Rows[0]["SoLuong"].ToString();
                result.CheDoSuDung     = dt.Rows[0]["CheDoSuDung"].ToString();
                result.ThoiHanBaoQuan  = dt.Rows[0]["ThoiHanBaoQuan"].ToString();
                result.TinhTrangVatLy  = dt.Rows[0]["TinhTrangVatLy"].ToString();
            }
            return(result);
        }
Ejemplo n.º 2
0
        public int addHoSo(HoSo newSec)
        {
            int           result = 0;
            SqlConnection conn   = new SqlConnection(connectionString);

            try
            {
                int    hoSoSoNumber = DatabaseUtil.extractNumber(newSec.HoSoSo);
                string query        = "INSERT INTO Su_HoSo(CoQuan, MaPhong, MucLucSo, HopSo, HoSoSo,NgonNgu, KyHieu, "
                                      + "TieuDe, GhiChu, ThoiGianBatDau, ThoiGianKetThuc, ButTich, SoLuong, "
                                      + "CheDoSuDung, ThoiHanBaoQuan, TinhTrangVatLy, HoSoSoNumber) VALUES('"
                                      + newSec.Coquan
                                      + "', '" + newSec.MaPhong
                                      + "', '" + newSec.MucLucSo
                                      + "', '" + newSec.HopSo
                                      + "', '" + newSec.HoSoSo
                                      + "', N'" + newSec.NgonNgu
                                      + "', N'" + newSec.KyHieu
                                      + "', N'" + newSec.TieuDe
                                      + "', N'" + newSec.GhiChu
                                      + "', '" + newSec.ThoiGianBatDau
                                      + "', '" + newSec.ThoiGianKetThuc
                                      + "', N'" + newSec.ButTich
                                      + "', '" + newSec.SoLuong
                                      + "',N'" + newSec.CheDoSuDung
                                      + "', '" + newSec.ThoiHanBaoQuan
                                      + "', '" + newSec.TinhTrangVatLy
                                      + "'," + hoSoSoNumber.ToString() + ") SELECT SCOPE_IDENTITY() as new_id;";
                conn.Open();
                DataTable tempTbl = getData(query);
                //executeDataByQuery(query, conn, null);
                int newId = 0;
                if (tempTbl != null && tempTbl.Rows.Count > 0)
                {
                    newId = (int)tempTbl.Rows[0][0];
                }
                result = newId;
            }
            catch (Exception e)
            {
                logUserManagement("addHoSo()", e.Message);
            }
            finally
            {
                conn.Close();
            }
            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Cap nhat thong tin ho so trong cac van ban lien quan
        /// </summary>
        /// <param name="Hoso_ID"></param>
        public void updateHosoInVanBan(HoSo Sec, SqlConnection conn)
        {
            string query = "UPDATE Su_VanBanTrongHoSo SET HoSoSo = N'" + Sec.HoSoSo
                           + "', Coquan = N'" + Sec.Coquan
                           + "', MaPhong = N'" + Sec.MaPhong
                           + "', MucLucSo = N'" + Sec.MucLucSo
                           + "' WHERE Hoso_ID = " + Sec.ID + "";

            try
            {
                executeDataByQuery(query, conn, null);
            }
            catch (Exception e)
            {
                logUserManagement("updateHosoInVanBan()", e.Message);
            }
        }
Ejemplo n.º 4
0
        public bool validateHoSo(HoSo hs, out string message)
        {
            bool rs = true;

            message = "";
            if (hs.Coquan == null || hs.Coquan.Trim().Length == 0)
            {
                rs       = false;
                message += "Chưa nhập trường: Cơ quan lưu trữ, ";
            }
            if (hs.MaPhong == null || hs.MaPhong.Trim().Length == 0)
            {
                rs = false;
                if (message.Length == 0)
                {
                    message += "Chưa nhập trường: ";
                }
                message += "Phông lưu trữ, ";
            }
            if (hs.HoSoSo == null || hs.HoSoSo.Trim().Length == 0)
            {
                rs = false;
                if (message.Length == 0)
                {
                    message += "Chưa nhập trường: ";
                }
                message += "Số hồ sơ, ";
            }
            if (hs.TieuDe == null || hs.TieuDe.Trim().Length == 0)
            {
                rs = false;
                if (message.Length == 0)
                {
                    message += "Chưa nhập trường: ";
                }
                message += "Tiêu đề hồ sơ, ";
            }
            if (hs.ID > 0)
            {
                //Validate 4 update
            }
            return(rs);
        }
Ejemplo n.º 5
0
        public bool updateHoSo(HoSo Sec)
        {
            bool          result = false;
            SqlConnection conn   = new SqlConnection(connectionString);

            string query = "UPDATE Su_HoSo SET Coquan = '" + Sec.Coquan
                           + "', MaPhong = '" + Sec.MaPhong
                           + "', MucLucSo = '" + Sec.MucLucSo
                           + "', HopSo = '" + Sec.HopSo
                           + "', HoSoSo = '" + Sec.HoSoSo
                           + "', NgonNgu = N'" + Sec.NgonNgu
                           + "', KyHieu = N'" + Sec.KyHieu
                           + "', TieuDe = N'" + Sec.TieuDe
                           + "', GhiChu = N'" + Sec.GhiChu
                           + "', ThoiGianBatDau = '" + Sec.ThoiGianBatDau
                           + "', ThoiGianKetThuc = '" + Sec.ThoiGianKetThuc
                           + "', ButTich = N'" + Sec.ButTich
                           + "', SoLuong = '" + Sec.SoLuong
                           + "', CheDoSuDung = N'" + Sec.CheDoSuDung
                           + "', ThoiHanBaoQuan = N'" + Sec.ThoiHanBaoQuan
                           + "', TinhTrangVatLy = N'" + Sec.TinhTrangVatLy
                           + "' WHERE ID = " + Sec.ID + "";

            try
            {
                conn.Open();
                executeDataByQuery(query, conn, null);
                result = true;
                updateHosoInVanBan(Sec, conn);
            }
            catch (Exception e)
            {
                logUserManagement("updateHoSo()", e.Message);
            }
            finally
            {
                conn.Close();
            }
            return(result);
        }