Beispiel #1
0
        public bool addTinhTrangVatLy(TinhTrangVatLy newSec)
        {
            bool          result = false;
            SqlConnection conn   = new SqlConnection(connectionString);

            try
            {
                string query = "INSERT INTO Su_TinhTrangVatLy (Name, Description) VALUES(N'"
                               + newSec.Name
                               + "', N'" + newSec.Description
                               + "');";
                conn.Open();
                executeDataByQuery(query, conn, null);
                result = true;
            }
            catch (Exception e)
            {
                logUserManagement("addApprover()", e.Message);
            }
            finally
            {
                conn.Close();
            }
            return(result);
        }
Beispiel #2
0
        public TinhTrangVatLy getTinhTrangVatLy(int ID)
        {
            TinhTrangVatLy result = null;
            string         query  = "SELECT ID, Name, Description FROM Su_TinhTrangVatLy WHERE ID = " + ID + "";
            DataTable      dt     = getData(query);

            if (dt.Rows.Count > 0)
            {
                result             = new TinhTrangVatLy();
                result.ID          = ID;
                result.Name        = dt.Rows[0][1].ToString();
                result.Description = dt.Rows[0][2].ToString();
            }
            return(result);
        }
Beispiel #3
0
        public bool updateTinhTrangVatLy(TinhTrangVatLy Sec)
        {
            bool          result = false;
            SqlConnection conn   = new SqlConnection(connectionString);
            string        query  = "UPDATE Su_TinhTrangVatLy SET Name = N'" + Sec.Name
                                   + "', Description = N'" + Sec.Description
                                   + "' WHERE ID = " + Sec.ID + "";

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