Esempio n. 1
0
        public bool addCoQuanLuuTru(CoQuanLuuTru newSec)
        {
            bool          result = false;
            SqlConnection conn   = new SqlConnection(connectionString);

            try
            {
                string query = "INSERT INTO Su_CoQuanLuuTru (Name, Code) VALUES(N'"
                               + newSec.Name
                               + "', N'" + newSec.Code
                               + "');";
                conn.Open();
                executeDataByQuery(query, conn, null);
                result = true;
            }
            catch (Exception e)
            {
                logUserManagement("addApprover()", e.Message);
            }
            finally
            {
                conn.Close();
            }
            return(result);
        }
Esempio n. 2
0
        public CoQuanLuuTru getCoQuanLuuTru(int ID)
        {
            CoQuanLuuTru result = null;
            string       query  = "SELECT ID, Name, Code FROM Su_CoQuanLuuTru WHERE ID = " + ID + "";
            DataTable    dt     = getData(query);

            if (dt.Rows.Count > 0)
            {
                result      = new CoQuanLuuTru();
                result.ID   = ID;
                result.Name = dt.Rows[0][1].ToString();
                result.Code = dt.Rows[0][2].ToString();
                //result.Layer = Int32.Parse( dt.Rows[0][3].ToString());
            }
            return(result);
        }
Esempio n. 3
0
        public bool updateCoQuanLuuTru(CoQuanLuuTru Sec)
        {
            bool          result = false;
            SqlConnection conn   = new SqlConnection(connectionString);
            string        query  = "UPDATE Su_CoQuanLuuTru SET Name = N'" + Sec.Name
                                   + "', Code = N'" + Sec.Code
                                   + "' WHERE ID = " + Sec.ID + "";

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