示例#1
0
        public bool updateMucLuc(MucLuc Sec)
        {
            bool          result = false;
            SqlConnection conn   = new SqlConnection(connectionString);
            string        query  = "UPDATE Su_MucLuc SET Name = N'" + Sec.Name
                                   + "', Description = N'" + Sec.Description
                                   + "', Layer = '" + Sec.Layer
                                   + "' WHERE ID = " + Sec.ID + "";

            try
            {
                conn.Open();
                executeDataByQuery(query, conn, null);
                result = true;
            }
            catch (Exception e)
            {
                logUserManagement("updateMucLuc()", e.Message);
            }
            finally
            {
                conn.Close();
            }
            return(result);
        }
示例#2
0
        public MucLuc getMucLuc(int ID)
        {
            MucLuc    result = null;
            string    query  = "SELECT ID, Name, Description, Layer FROM Su_MucLuc WHERE ID = " + ID + "";
            DataTable dt     = getData(query);

            if (dt.Rows.Count > 0)
            {
                result             = new MucLuc();
                result.ID          = ID;
                result.Name        = dt.Rows[0][1].ToString();
                result.Description = dt.Rows[0][2].ToString();
                result.Layer       = Int32.Parse(dt.Rows[0][3].ToString());
            }
            return(result);
        }
示例#3
0
        public bool addMucLuc(MucLuc newSec)
        {
            bool          result = false;
            SqlConnection conn   = new SqlConnection(connectionString);

            try
            {
                string query = "INSERT INTO Su_MucLuc VALUES( N'" + newSec.Name
                               + "', N'" + newSec.Description
                               + "', '" + newSec.Layer + "');";
                conn.Open();
                executeDataByQuery(query, conn, null);
                result = true;
            }
            catch (Exception e)
            {
                logUserManagement("addApprover()", e.Message);
            }
            finally
            {
                conn.Close();
            }
            return(result);
        }