示例#1
0
        public bool addLoaiVanBan(LoaiVanBanObject newSec)
        {
            bool          result = false;
            SqlConnection conn   = new SqlConnection(connectionString);

            try
            {
                string query = "INSERT INTO Su_LoaiVanBan (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);
        }
示例#2
0
        public LoaiVanBanObject getLoaiVanBan(int ID)
        {
            LoaiVanBanObject result = null;
            string           query  = "SELECT ID, Name, Description FROM Su_LoaiVanBan WHERE ID = " + ID + "";
            DataTable        dt     = getData(query);

            if (dt.Rows.Count > 0)
            {
                result             = new LoaiVanBanObject();
                result.ID          = ID;
                result.Name        = dt.Rows[0][1].ToString();
                result.Description = dt.Rows[0][2].ToString();
            }
            return(result);
        }
示例#3
0
        public bool updateLoaiVanBan(LoaiVanBanObject Sec)
        {
            bool          result = false;
            SqlConnection conn   = new SqlConnection(connectionString);
            string        query  = "UPDATE Su_LoaiVanBan 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("updateLoaiVanBan()", e.Message);
            }
            finally
            {
                conn.Close();
            }
            return(result);
        }